Reputation: 1
I want to read a (log file being written continuously by an app)
Currently I have temp solution using RandomAccessFile (read mode)
Is there any other solution to this problem ?
Upvotes: 0
Views: 737
Reputation: 115338
Java 7 has new API that allows listening to the file system events: http://java.dzone.com/news/how-watch-file-system-changes
If you are stuck with previous version of java use poling as described here: File changed listener in Java
Upvotes: 1
Reputation: 13890
You probably could use FileInputStream
to read this file. The fact that another process/thread is writing to it should not be a problem, especially if it only appends data to the file.
Upvotes: 0