I want to set line reader to first position , for example It just finished the reading whole text file and I want to set line reader to the position when it first started to read text file ?
I opened txt file using scanner
Is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Scanneritself has no way to rewind the input. You might be able toreset()the underlying input stream, but that might not be supported depending on what stream implementation is being used. Your best bet is to close and reopen the input.EDIT:
If you cannot close/reopen the input, then try calling
reset()on the underlying stream.