GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Read file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Read file" Watch "Read file" New topic
Author

Read file

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635


The second while doesn't work , why?

I want to compare and test difference between readline and read.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42028
    
  64
ItDoesntWorkIsUseless.

The first loop exhausts the input - there's nothing left for the second loop to read.


Ping & DNS - my free Android networking tools app
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Comment for first while loop then you will know how second while loop execute.


Life is easy because we write the source code.....
abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
Then the solution is that I must create new FileInputStream?
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

You may also create new BufferedReader to read from the top.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read file