This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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: 19651
    
  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 .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Read a Flat File line by line and add it to a StringBuffer
 
Similar Threads
unable to exit program..
FileReader / BufferedReader will only read the first line from the file
Can Jsp be converted into String
Do I need to use a stringbuffer?
How to Read a Flat File Data