| Constructor and Description |
|---|
WatcherChain(Watcher... watchers)
构造
|
| Modifier and Type | Method and Description |
|---|---|
WatcherChain |
addChain(Watcher element)
加入责任链
|
Iterator<Watcher> |
iterator() |
static WatcherChain |
of(Watcher... watchers)
创建观察者链
WatcherChain |
void |
onCreate(WatchEvent<?> event,
WatchKey key)
文件创建时执行的方法
|
void |
onDelete(WatchEvent<?> event,
WatchKey key)
文件删除时执行的方法
|
void |
onModify(WatchEvent<?> event,
WatchKey key)
文件修改时执行的方法
文件修改可能触发多次 |
void |
onOverflow(WatchEvent<?> event,
WatchKey key)
事件丢失或出错时执行的方法
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic WatcherChain(Watcher... watchers)
watchers - 观察者列表public static WatcherChain of(Watcher... watchers)
WatcherChainwatchers - 观察者列表WatcherChainpublic void onCreate(WatchEvent<?> event, WatchKey key)
WatcheronCreate in interface Watcherevent - 事件,可通过WatchEvent.context()获取创建的文件或目录名称key - 事件发生的WatchKey,可以通过WatchKey.watchable()获取监听的Path路径public void onModify(WatchEvent<?> event, WatchKey key)
WatcheronModify in interface Watcherevent - 事件,可通过WatchEvent.context()获取创建的文件或目录名称key - 事件发生的WatchKey,可以通过WatchKey.watchable()获取监听的Path路径public void onDelete(WatchEvent<?> event, WatchKey key)
WatcheronDelete in interface Watcherevent - 事件,可通过WatchEvent.context()获取创建的文件或目录名称key - 事件发生的WatchKey,可以通过WatchKey.watchable()获取监听的Path路径public void onOverflow(WatchEvent<?> event, WatchKey key)
WatcheronOverflow in interface Watcherevent - 事件,可通过WatchEvent.context()获取创建的文件或目录名称key - 事件发生的WatchKey,可以通过WatchKey.watchable()获取监听的Path路径public WatcherChain addChain(Watcher element)
ChainaddChain in interface Chain<Watcher,WatcherChain>element - 责任链新的环节元素Copyright © 2025. All rights reserved.