Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading the previous lines in a file

 
SriJyothsna Yeleswarapu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, SriJyothsna.
Have a look at java.io.PushbackReader or java.io.RandomAccessFile and see if they will meet your requirements.
 
Your mother was a hamster and your father was a tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!