954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Reading a Constantly Updating File

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?

TJ

tjsail
Light Poster
40 posts since Nov 2009
Reputation Points: 10
Solved Threads: 3
 

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.

javaAddict
Nearly a Senior Poster
Team Colleague
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
 

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.

TJ

tjsail
Light Poster
40 posts since Nov 2009
Reputation Points: 10
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You