接口的使用
java.nio.file.WatchKey
使用 WatchKey 的包
-
WatchKey 在 java.nio.file 中的用法
java.nio.file 中返回 WatchKey 的方法修饰符和类型方法描述WatchService.poll()检索并删除下一个监视密钥,如果不存在则为null。检索并删除下一个监视键,如果还没有,则在必要时等待指定的等待时间。default WatchKeyPath.register(WatchService watcher, WatchEvent.Kind<?>... events) 向监视服务注册此路径所在的文件。Path.register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) 向监视服务注册此路径所在的文件。Watchable.register(WatchService watcher, WatchEvent.Kind<?>... events) 向监视服务注册对象。Watchable.register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) 向监视服务注册对象。WatchService.take()检索并删除下一个监视密钥,如果尚不存在则等待。