This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes I/O and Streams and the fly likes Read a Flat File line by line and add it to a StringBuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Read a Flat File line by line and add it to a StringBuffer" Watch "Read a Flat File line by line and add it to a StringBuffer" New topic
Author

Read a Flat File line by line and add it to a StringBuffer

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

I am trying to read a Flat File which is line by line "\n" new line seperated .
I want to read each line and add it to a StringBuffer .

I tried this way ,but its not working .Please help




Save India From Corruption - Anna Hazare.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19678
    
  18

You never change item. You read one line, then keep using the same line over and over.

You'll see that usually one of the following (nearly identical) loops is used:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you , Rob , you were always there to help .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read a Flat File line by line and add it to a StringBuffer