public static final class DirectoryWatcher.Builder
extends java.lang.Object
DirectoryWatcher. Use DirectoryWatcher.builder() to get a new
instance.| Modifier and Type | Method and Description |
|---|---|
DirectoryWatcher |
build() |
DirectoryWatcher.Builder |
fileHasher(FileHasher fileHasher)
Defines the file hasher to be used by the watcher.
|
DirectoryWatcher.Builder |
fileHashing(boolean enabled)
Defines whether file hashing should be used to catch duplicate events.
|
DirectoryWatcher.Builder |
fileTreeVisitor(FileTreeVisitor fileTreeVisitor)
Defines the file tree visitor to be used by the watcher.
|
DirectoryWatcher.Builder |
listener(DirectoryChangeListener listener)
Set a listener that will be called when a directory change event occurs.
|
DirectoryWatcher.Builder |
logger(org.slf4j.Logger logger)
Set a logger to be used by the watcher.
|
DirectoryWatcher.Builder |
path(java.nio.file.Path path)
Set a single path to watch.
|
DirectoryWatcher.Builder |
paths(java.util.List<java.nio.file.Path> paths)
Set multiple paths to watch.
|
DirectoryWatcher.Builder |
watchService(java.nio.file.WatchService watchService)
Set a
WatchService implementation that will be used by the watcher. |
public DirectoryWatcher.Builder paths(java.util.List<java.nio.file.Path> paths)
public DirectoryWatcher.Builder path(java.nio.file.Path path)
public DirectoryWatcher.Builder listener(DirectoryChangeListener listener)
public DirectoryWatcher.Builder watchService(java.nio.file.WatchService watchService)
WatchService implementation that will be used by the watcher.
By default, this detects your OS and either uses the native JVM watcher or the macOS watcher.
public DirectoryWatcher.Builder logger(org.slf4j.Logger logger)
LoggerFactory.getLogger(DirectoryWatcher.class)public DirectoryWatcher.Builder fileHashing(boolean enabled)
true.public DirectoryWatcher.Builder fileHasher(FileHasher fileHasher)
Note: will implicitly enable file hashing. Setting to null is equivalent to fileHashing(false)
public DirectoryWatcher.Builder fileTreeVisitor(FileTreeVisitor fileTreeVisitor)
public DirectoryWatcher build() throws java.io.IOException
java.io.IOException