如何读取活动文件-由另一个编写器线程编写的文件 [英] How to read a live file - that is being writen by another writer thread
本文介绍了如何读取活动文件-由另一个编写器线程编写的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读取(由应用程序连续写入的日志文件)
I want to read a (log file being written continuously by an app)
目前,我有使用RandomAccessFile(读取模式)的临时解决方案
Currently I have temp solution using RandomAccessFile (read mode)
这个问题还有其他解决方案吗?
Is there any other solution to this problem ?
推荐答案
Java 7 has new API that allows listening to the file system events: http://java.dzone.com/news/how-watch-file-system-changes
如果您对Java的早期版本感到困惑,请按照以下说明使用极化: Java
If you are stuck with previous version of java use poling as described here: File changed listener in Java
这篇关于如何读取活动文件-由另一个编写器线程编写的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文