It's not a secret anymore!*
The moose likes I/O and Streams and the fly likes Reading the previous lines in a file 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 "Reading the previous lines in a file " Watch "Reading the previous lines in a file " New topic
Author

Reading the previous lines in a file

SriJyothsna Yeleswarapu
Greenhorn

Joined: Jan 16, 2006
Posts: 1
Is there some way to skip to the previous lines in a file, besides customizing the readLine() method for it?
I intend to skip to previous lines in a text file after having reached a position by a binary search on some element in it.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Welcome to the JavaRanch, SriJyothsna.
Have a look at java.io.PushbackReader or java.io.RandomAccessFile and see if they will meet your requirements.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
Consider Paul's rocket mass heater.
 
subject: Reading the previous lines in a file
 
Similar Threads
Compare Two Text Files
Multiple Readers/Streams on a single file
Illegal constant pool type
VBScript to compare files... not really working
Java Logger