public interface PathWatcher<T> extends FileTreeViews.Observable<T>, java.lang.AutoCloseable
Event.Kind is best effort, but should not be
relied upon to accurately reflect the state of the file.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Catch any exceptions in subclasses.
|
Either<java.io.IOException,java.lang.Boolean> |
register(java.nio.file.Path path,
int maxDepth)
Register a path to monitor for file events.
|
void |
unregister(java.nio.file.Path path)
Stop watching a path.
|
addObserver, removeObserverEither<java.io.IOException,java.lang.Boolean> register(java.nio.file.Path path, int maxDepth)
path - the directory to watch for file eventsmaxDepth - the maximum maxDepth of subdirectories to watchEither containing the result of the registration or an
IOException if registration fails. This method should be idempotent and return true the
first time the directory is registered or when the depth is changed. Otherwise it should
return false.void unregister(java.nio.file.Path path)
path - the path to remove from monitoringvoid close()
close in interface java.lang.AutoCloseable