aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 606


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: 39578
    
  27
ItDoesntWorkIsUseless.

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


Ping & DNS - updated with new look and Ping home screen widget
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: 606
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
 
Similar Threads
How to Read a Flat File Data
What's wrong with the program?
BufferedReader contents into Array
file2String faster code
bufferedwriter/filewriter...