File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading a file. Is it possible to choose the line to start from?

 
Rudolph Ten
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to choose the line I want to start reading the file from? I am new to java.

I was using this code:
=========================
while((s = br.readLine()) != null) {
System.out.println(s);
totalLineReadInCnt++;
=========================
Thanks in advance
Rudy
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rudolph,
The only I/O class that lets you start reading a file anywhere is the RandomAccessFile class. It provides a readLine method so you should be able to use it to start reading anywhere. I don't think you can tell it to skip so many lines though because the skipping only works with bytes.
Regards,
Manfred.
 
Rudolph Ten
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Manfred....that did it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic