Add an observer of events.
Add an observer of events.
the Observer to add
the handle to the observer.
Shutdown the PathWatcher, freeing any native resources.
Register a path to monitor for file events.
Register a path to monitor for file events. The watcher will only watch child subdirectories up to maxDepth. For example, with a directory structure like /foo/bar/baz, if we register the path /foo/ with maxDepth 0, we will be notified for any files that are created, updated or deleted in foo, but not bar. If we increase maxDepth to 1, then the files in /foo/bar are monitored, but not the files in /foo/bar/baz.
the directory to watch for file events
the maximum maxDepth of subdirectories to watch
an com.swoval.functional.Either 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.
Remove an observer that was previously added via PathWatcher.addObserver
Remove an observer that was previously added via PathWatcher.addObserver
the handle returned by PathWatcher.addObserver corresponding to the observer to remove.
Stop watching a path.
Stop watching a path.
the path to remove from monitoring
Watches directories for file changes. The api permits recursive watching of directories unlike the java.nio.file.WatchService. Some of the behavior may vary by platform due to fundamental differences in the underlying file event apis. For example, Linux doesn't support recursive directory monitoring via inotify, so it's possible in rare cases to miss file events for newly created files in newly created directories. On OSX, it is difficult to disambiguate file creation and modify events, so the kind of event is best effort, but should not be relied upon to accurately reflect the state of the file.