• Post Reply Bookmark Topic Watch Topic
  • New Topic

InputStream help

 
Derrek Alexander
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the following snippet:



The output from line AAA write correctly, where the output from line BBB is blank.

What's the deal? Can I read an InputStream only once?

Thanks,
Derrek
[ August 14, 2006: Message edited by: Derrek Alexander ]
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Derrek.
You must have missed our Naming Policy on your way in. We try to keep things friendly around here so we ask that you use your first name and last name as your displayed name. You can change your displayed name here.
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Derrek.
The answer to your question is yes, most InputStreams and Readers can only be read once. There are exceptions to this rule, like PushbackReader and the corresponding PushbackInputStream, which allow you to put data back into the stream, or using mark() and reset() to "rewind" a stream.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!