Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

I/O

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i we wanna read data frm file which stream should we use 2 read one line at a time frm source ...
thanks ..
manal
 
Trailboss
Posts: 23460
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manal,
I'm having a tough time understanding your question. Do you wanna read a text file one line at a time?
 
manal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya paul ... i wanna read a text file line by line ...
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Manyways of diong it
BufferedReader buf = new BufferedReader(new FileReader(filename));
buf.readLine();
Then if u want to use streams
DataInputStream dis = new DataIunputStream(new BufferedInputStream(new FileInputStream(filename)));
dis.readLine() //note this is deprecated, so the first way s the moe preferred one
Thanks
Sanjeet

Originally posted by manal:
ya paul ... i wanna read a text file line by line ...


reply
    Bookmark Topic Watch Topic
  • New Topic