What is the most efficient way to get and replace the last line of a text file (in Java 1.4) that could potentially contain millions of lines? The code examples I've seen so far have been required to reprocess the entire file in turn, before determining if the last line was reached.
A similar question was asked about replacing the first line in a text file with Java , but the adapted solution would still require going through the whole file using BufferedReader to determine the last line in the file.
David source share