convenient way to read text file multiple times without reopening it



Hi,

I suppose that a convenient way to read text file is through FileReader.
But FileReader does not support the reset().
So, as a temporal remedy, I am opening the file twice:

Reader fr = new FileReader("filename");
......
fr.close();
......
fr = new FileReader("filename");
......


Of course this is not a clean way. At least, the file could possibly be
removed or renamed by another program between the two calls to "new
FileReader()". So I want to open the file once and then read it
(sequentially) twice.
I suppose Java provides a convenient way for doing it, but I'm unable to
figure it out.

Thank you for pointing me the right way!

Tomas
.



Relevant Pages