This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 635


The second while doesn't work , why?

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

Joined: Mar 22, 2005
Posts: 42958
    
  73
ItDoesntWorkIsUseless.

The first loop exhausts the input - there's nothing left for the second loop to read.
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

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: 632

You may also create new BufferedReader to read from the top.
 
Have you checked out Aspose?
 
subject: Read file
 
It's not a secret anymore!