aspose file tools
The moose likes Beginning Java and the fly likes Reading a file. Is it possible to choose the line to start from? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Reading a file. Is it possible to choose the line to start from?" Watch "Reading a file. Is it possible to choose the line to start from?" New topic
Author

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

Rudolph Ten
Greenhorn

Joined: Jan 23, 2002
Posts: 9
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

Joined: Jan 09, 2001
Posts: 1492
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

Joined: Jan 23, 2002
Posts: 9
Thanks Manfred....that did it.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Reading a file. Is it possible to choose the line to start from?
 
Similar Threads
Comparing contents of a file with String[]
Route Finder Front End
How to stop a running task initiated by a servlet?
Problem with renaming file after reading it
could we ignore few lines from an BufferedReader input stream