943,164 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 489
  • Java RSS
Feb 9th, 2010
0

Reading a Constantly Updating File

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 3
Light Poster
tjsail is offline Offline
40 posts
since Nov 2009
Feb 9th, 2010
0
Re: Reading a Constantly Updating File
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.
Last edited by javaAddict; Feb 9th, 2010 at 11:42 am.
Sponsor
Featured Poster
Reputation Points: 1005
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,256 posts
since Dec 2007
Feb 9th, 2010
0
Re: Reading a Constantly Updating File
There is a game called NeverwinterNights that prints all of the data to a log file in a form such as
Quote ...
[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
Reputation Points: 10
Solved Threads: 3
Light Poster
tjsail is offline Offline
40 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Client Server Error
Next Thread in Java Forum Timeline: Random Numbers on button





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC