Class DirectoryWatcher.Builder

  • Enclosing class:
    DirectoryWatcher

    public static final class DirectoryWatcher.Builder
    extends java.lang.Object
    A builder for a DirectoryWatcher. Use DirectoryWatcher.builder() to get a new instance.
    • Method Detail

      • paths

        public DirectoryWatcher.Builder paths​(java.util.List<java.nio.file.Path> paths)
        Set multiple paths to watch.
      • watchService

        public DirectoryWatcher.Builder watchService​(java.nio.file.WatchService watchService)
        Set a 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.

      • logger

        public DirectoryWatcher.Builder logger​(org.slf4j.Logger logger)
        Set a logger to be used by the watcher. This defaults to LoggerFactory.getLogger(DirectoryWatcher.class)
      • fileHashing

        public DirectoryWatcher.Builder fileHashing​(boolean enabled)
        Defines whether file hashing should be used to catch duplicate events. Defaults to true.
      • fileHasher

        public DirectoryWatcher.Builder fileHasher​(FileHasher fileHasher)
        Defines the file hasher to be used by the watcher.

        Note: will implicitly enable file hashing. Setting to null is equivalent to fileHashing(false)

      • build

        public DirectoryWatcher build()
                               throws java.io.IOException
        Throws:
        java.io.IOException