File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes About input streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About input streams" Watch "About input streams" New topic
Author

About input streams

Rohit chandra
Greenhorn

Joined: Jun 23, 2007
Posts: 15


Well does the valueof choice dipends upon the hierarchy of user input??? I mean whenevr i swap block 2 with 1 the value of choice changes??
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

I don't understand your question, but note that BufferedReader can read more characters than you ask for and store them up for later requests; that's what "buffering" means. Therefore you should never, ever create more than one BufferedReader for a given stream, and furthermore, once you create a BufferedReader for a stream, all reading from that stream must go through that BufferedReader. If you don't follow this advice, data will seem to mysteriously "disappear."

Finally, for the special case of System.in, which has its own buffering, it makes sense to turn BufferedReader's buffering off, anyway, or other weird stuff can happen. You do this by supplying a second argument to the constructor, the number '1'.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About input streams
 
Similar Threads
Command-Line arguments
file output question
Appending to a file
probelm with errors
Reading in a file