• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Rob Spoor
Sheriff
Pie
Posts: 20494
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you , Rob , you were always there to help .
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic