Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need to reuse input stream

Stephanie Smith
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a text file object where the constructor
takes an input stream. The interface has a
getReader() call that returns the reader
for this text file object.
In my implementation, if I just return a reader
using this input stream like:
return new InputStreamReader(inputStream);
Then its a one time use implementation. The first
call returns the reader. Its read until end of stream. The calling application closes the reader
and so it can't call getReader() a second time.
Any ideas on how the implementation can make
this stream re-usable? So it can be used more
than one time?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic