文件变化监视 java.nio.file.WatchService
2015-02-09 17:28
483 查看
WatchKey java.nio.file.Path.register(WatchService watcher, Kind<?>... events) throws IOException
为该文件注册watch service。
Registers the file located by this path with a watch service.
WatchKey java.nio.file.WatchService.take() throws InterruptedException
检索并移除下一个watch key。若没有可检索的则阻塞。
Retrieves and removes next watch key, waiting if none are yet present.
List<WatchEvent<?>> java.nio.file.WatchKey.pollEvents()
检索并移除所有该watch key
Retrieves and removes all pending events for this watch key, returning a List of the events that were retrieved.
Kind<?> java.nio.file.WatchEvent.kind()
返回事件种类
Returns the event kind.
String java.nio.file.WatchEvent.Kind.name()
返回事件种类的名字。
Returns the name of the event kind.
? java.nio.file.WatchEvent.context()
返回事件发生的环境,简单讲就是不带路径的文件名。
Returns the context for the event.
为该文件注册watch service。
Registers the file located by this path with a watch service.
WatchKey java.nio.file.WatchService.take() throws InterruptedException
检索并移除下一个watch key。若没有可检索的则阻塞。
Retrieves and removes next watch key, waiting if none are yet present.
List<WatchEvent<?>> java.nio.file.WatchKey.pollEvents()
检索并移除所有该watch key
Retrieves and removes all pending events for this watch key, returning a List of the events that were retrieved.
Kind<?> java.nio.file.WatchEvent.kind()
返回事件种类
Returns the event kind.
String java.nio.file.WatchEvent.Kind.name()
返回事件种类的名字。
Returns the name of the event kind.
? java.nio.file.WatchEvent.context()
返回事件发生的环境,简单讲就是不带路径的文件名。
Returns the context for the event.
相关文章推荐
- 使用java.nio.file.WatchService监控文件夹里的文件再操作文件出现的“文件不存在或目录不存在”的错误
- [疯狂Java]NIO.2:WatchService、WatchKey(监控文件变化)
- Java利用WatchService监听文件变化示例
- java利用WatchService实时监控某个目录下的文件变化并按行解析(注:附源代码)
- NIO--WatchService、WatchKey(监控文件变化)
- Java WatchService监视文件变动
- java监控文件夹内文件变化并且进行文件同步bigfilesync
- JDK1.7 之java.nio.file.Files 读取文件仅需一行代码实现
- 使用JDK1.7 java.nio.file.Files.walkFileTree方法遍历文件夹下的文件
- 使用FileSystemWatcher监视文件变化
- JDK1.7 之java.nio.file.Files 读取文件只要一行
- JAVA 文件监控 WatchService
- WatchService API实现监听文件系统中的文件变化(包括各级子目录)
- 08. Java NIO FileChannel 文件通道
- c#的FileSystemWatcher对象监视文件的变化的事件,无休止的触发事件的解决办法
- Java7 WatchService 监控文件变化
- 使用FileSystemWatcher监视文件变化
- java.nio.channels.FileChannel文件通道源码解析
- JAVA 文件监控 WatchService的示例方法
- 利用WatchService监听文件变化