Is it possible to read a file as lines are written to it but not lose your location in the file?

As in there is a program that will write lines of text to a file until it reaches 2.4MB. I want to read this file as these lines of text are added but not start at the top each time.

Is this possible?


7 Years
Discussion Span
Last Post by tjsail

Who is writing to file? Maybe you don't need to read the file, but the lines that are written by the process.
But if the files closes and then someone else tries to append something else to that file with a new writer then if you don't remember what was written by the first writer then you would have to read the file.

Perhaps if you explain your problem better you would get a better answer, but checking the RandomAccessFile class might be a good place to start.

Edited by javaAddict: n/a


There is a game called NeverwinterNights that prints all of the data to a log file in a form such as

[CHAT WINDOW TEXT] [Mon Feb 08 08:42:03] [42Server48] ===== Server 314 (1 player) =====

and i am looking to read this data from the file (named nwnlogfile1.txt) as it is written. i have no idea how i would go about capturing the data as it is written by the process.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.