posted 21 years ago
So if your text file is fixed length, you could use the RandomAccessFile class.
You will have to know how the text is encoded in your file, because you will be reading the lines into an array of bytes. For example, is your file Ascii or Unicode?
This class will allow you to index the lines in your text file by ordinal position. If you want to find a line by its contents, you will have no choice but to read the entire file sequentially until you find the line you are looking for. But if you know that you want to read line #167, and that the records are 80 bytes long (counting the line seperator), your code might look similar to this (off the top of my head.. might not be exact)