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


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "streams " Watch "streams " New topic
Author

streams

nitiish chinnaraju
Greenhorn

Joined: Jan 16, 2014
Posts: 13


in the above example the loop is not ending i dont know why? please tell me
Scott Winterbourne
Ranch Hand

Joined: Jan 30, 2014
Posts: 115
    
    1

Hi Nitiish,

Please put your code samples inside of [ code ] tags. It will make it much easier for everybody to read your code sample.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19687
    
  10

You're reading characters from System.in, i.e. the console, and continue to read until you reach the end of the stream. But when would you expect to reach the end of the stream of data coming from the console?
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2709
    
  56
Hi Nitiish,

In future please do as Scott has suggested and use code tags when posting code. Also make sure your code is properly formatted, I've added code tags to your post for you but because your code isn't formatted sensibly it's still really hard to read.

See how much easier the following is to read:
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3717
    
  61

Paul Clapham wrote:You're reading characters from System.in, i.e. the console, and continue to read until you reach the end of the stream. But when would you expect to reach the end of the stream of data coming from the console?

In the good old DOS there was the End-of-file control character (Ctrl-Z). Perhaps this would work in Java too?
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19687
    
  10

Perhaps it would; I knew about that too (it was Ctrl-D in some other shells which I used a long time ago), but it might not be the best solution to the OP's problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: streams
 
It's not a secret anymore!