Ximvu
06-23-2005, 04:14 PM
Does anyone know if there's a way to read the last line of a file? I'm writing a Java application that reads in a text file that looks something like...
1 dog 56 73 287 9.54
2 cat 32 10 984 2.45
...
The first number in the line is an index number, and these files can be anywhere from 2,000 to 10,000 lines long. I'd like to read in the index number of the last line so I can find out how many categories I'm working with and set up some arrays. If it isn't possible, I can always use ArrayLists, or just read through the entire file to get to the last line, but it seems like there should be some way to jump there...maybe I just have wishful thinking.
1 dog 56 73 287 9.54
2 cat 32 10 984 2.45
...
The first number in the line is an index number, and these files can be anywhere from 2,000 to 10,000 lines long. I'd like to read in the index number of the last line so I can find out how many categories I'm working with and set up some arrays. If it isn't possible, I can always use ArrayLists, or just read through the entire file to get to the last line, but it seems like there should be some way to jump there...maybe I just have wishful thinking.