Well, there is a kludgy alternative if you can be sure that the last line is less than X characters long.
You could open the file as a RandomAccessFile, seek to the end minus X bytes, read the last X bytes into a byte array and look backwards through that for the start of the last line. Turning the bytes located into a String is simple.
posted 11 years ago
Thanks for your replies.
But how can i ignore rest of the lines??
Randomacces file would have been good. but the size of the file is not a constant!!