You can rewind the file with reset()
, provided that you have mark()
'ed the position you want to rewind to. These methods should be invoked on the decorator, i.e. BufferedReader
.
However, you may probably want to reconsider your design as you can easily read the whole file into some data structure (even a list of strings, or some stream backed by a string) and use the data multiple times.