### FSEventStreamStart Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Starts a file system event stream, enabling it to begin capturing events. ```java boolean FSEventStreamStart(FSEventStreamRef streamRef) ``` -------------------------------- ### run() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.CFRunLoopThread.html The main entry point for the thread's execution. This method starts the CFRunLoop, which listens for file system events. ```APIDOC ## run() Method ### Description Starts the CFRunLoop to listen for file system events. This method is the entry point for the thread. ### Method `void run()` ### Implements `run` in interface `java.lang.Runnable` ### Overrides `run` in class `java.lang.Thread` ``` -------------------------------- ### DirectoryChangeEvent rootPath() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns the root path that is being watched. This is the starting point for the watcher. ```java public java.nio.file.Path rootPath() ``` -------------------------------- ### Get Listener Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Retrieve the DirectoryChangeListener associated with this watcher. ```APIDOC ## getListener ### Description Get the `DirectoryChangeListener` that is registered with this watcher. ### Method `public DirectoryChangeListener getListener()` ``` -------------------------------- ### DirectoryWatcher Builder Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Get a new builder for a DirectoryWatcher instance. Use this to configure and create a watcher. ```java public static DirectoryWatcher.Builder builder() ``` -------------------------------- ### DirectoryWatcher Builder Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Get a new builder for a DirectoryWatcher instance. ```APIDOC ## builder ### Description Get a new builder for a `DirectoryWatcher`. ### Method `public static DirectoryWatcher.Builder builder()` ``` -------------------------------- ### Get Path Hashes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Returns a map of paths to their corresponding file hashes. ```java public java.util.Map pathHashes() ``` -------------------------------- ### Watch Directories Asynchronously with Executor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Start watching for changes asynchronously using a specified executor. ```APIDOC ## watchAsync ### Description Start watching for changes asynchronously. ### Method `public CompletableFuture watchAsync(Executor executor)` ### Parameters #### Path Parameters - **executor** (Executor) - the executor to use to watch asynchronously ### Notes The future completes when the listener stops listening or the watcher is closed. This method will block until the watcher is initialized and successfully watching. ``` -------------------------------- ### Get Path Hashes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Retrieve a map of paths to their corresponding file hashes. ```APIDOC ## pathHashes ### Description Returns a map of paths to their computed file hashes. ### Method `public Map pathHashes()` ``` -------------------------------- ### Get Listener Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Retrieves the DirectoryChangeListener associated with this watcher. ```java public DirectoryChangeListener getListener() ``` -------------------------------- ### Get Created Entries Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSet.html Retrieves a set of `ChangeSetEntry` objects representing files that were created. ```java java.util.Set created() ``` -------------------------------- ### Recursive File Tree Visitation Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.html Recursively visits files and directories starting from a given path. It accepts callbacks for handling directory and file events during the traversal. ```java void recursiveVisitFiles(java.nio.file.Path file, FileTreeVisitor.Callback onDirectory, FileTreeVisitor.Callback onFile) throws java.io.IOException ``` -------------------------------- ### Murmur3F Get Value Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Methods to retrieve the computed hash value in various formats. ```APIDOC ## getValue() ### Description Returns the current hash value as a 64-bit long. ### Method ```java public long getValue() ``` ### Implements `java.util.zip.Checksum.getValue()` ``` ```APIDOC ## getValueHigh() ### Description Returns the higher 64 bits of the 128-bit hash. ### Method ```java public long getValueHigh() ``` ``` ```APIDOC ## getValueBigInteger() ### Description Returns the current hash value as a positive BigInteger. ### Method ```java public java.math.BigInteger getValueBigInteger() ``` ``` ```APIDOC ## getValueHexString() ### Description Returns the current hash value as a hexadecimal string, padded with leading zeros to ensure a length of 32 characters. ### Method ```java public java.lang.String getValueHexString() ``` ``` ```APIDOC ## getValueBytesBigEndian() ### Description Returns the current hash value as a byte array in big-endian order. ### Method ```java public byte[] getValueBytesBigEndian() ``` ``` ```APIDOC ## getValueBytesLittleEndian() ### Description Returns the current hash value as a byte array in little-endian order. ### Method ```java public byte[] getValueBytesLittleEndian() ``` ``` -------------------------------- ### Recursive File Tree Traversal Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/DefaultFileTreeVisitor.html Recursively visits files and directories starting from a given path. It accepts callbacks for handling directories and files encountered during the traversal. This method may throw an IOException if an I/O error occurs. ```java public void recursiveVisitFiles(java.nio.file.Path file, FileTreeVisitor.Callback onDirectory, FileTreeVisitor.Callback onFile) throws java.io.IOException ``` -------------------------------- ### Run Run Loop - CarbonAPI Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Starts the current run loop, causing it to process events. The function blocks until the run loop is stopped. ```Objective-C void CFRunLoopRun() ``` -------------------------------- ### Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Initializes a new instance of the MacOSXListeningWatchService with default configuration. ```APIDOC ## MacOSXListeningWatchService() ### Description Initializes a new instance of the MacOSXListeningWatchService with default configuration. ### Constructor `public MacOSXListeningWatchService()` ``` -------------------------------- ### Asynchronous Watch with Custom Executor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Start watching for changes asynchronously using a provided executor. This method blocks until the watcher is initialized and successfully watching. The future completes when the listener stops listening or the watcher is closed. ```java public java.util.concurrent.CompletableFuture watchAsync(java.util.concurrent.Executor executor) ``` -------------------------------- ### Constructor with Config Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Initializes a new instance of the MacOSXListeningWatchService with a custom configuration. ```APIDOC ## MacOSXListeningWatchService(MacOSXListeningWatchService.Config config) ### Description Initializes a new instance of the MacOSXListeningWatchService with a custom configuration. ### Constructor `public MacOSXListeningWatchService(MacOSXListeningWatchService.Config config)` ``` -------------------------------- ### Get Hash Value as BigInteger Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Returns the hash value as a positive BigInteger. ```java public java.math.BigInteger getValueBigInteger() ``` -------------------------------- ### Build the DirectoryWatcher instance Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Constructs and returns a new DirectoryWatcher instance with the configured settings. This method may throw an IOException. ```java public DirectoryWatcher build() throws java.io.IOException ``` -------------------------------- ### MacOSXListeningWatchService Constructor with Config Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Constructs a new MacOSXListeningWatchService with a specified configuration. Use this constructor when custom configuration is required. ```java public MacOSXListeningWatchService(MacOSXListeningWatchService.Config config) ``` -------------------------------- ### DirectoryWatcher.Builder Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Methods for configuring the DirectoryWatcher. ```APIDOC ## DirectoryWatcher.Builder A builder for a `DirectoryWatcher`. Use `DirectoryWatcher.builder()` to get a new instance. ### Methods #### `paths(List paths)` Set multiple paths to watch. #### `path(Path path)` Set a single path to watch. #### `listener(DirectoryChangeListener listener)` Set a listener that will be called when a directory change event occurs. #### `watchService(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(org.slf4j.Logger logger)` Set a logger to be used by the watcher. This defaults to `LoggerFactory.getLogger(DirectoryWatcher.class)`. #### `fileHashing(boolean enabled)` Defines whether file hashing should be used to catch duplicate events. Defaults to `true`. #### `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)`. #### `fileTreeVisitor(FileTreeVisitor fileTreeVisitor)` Defines the file tree visitor to be used by the watcher. #### `build()` Builds and returns a new `DirectoryWatcher` instance. This method may throw an `IOException`. ``` -------------------------------- ### Get Deleted Entries Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSet.html Retrieves a set of `ChangeSetEntry` objects representing files that were deleted. ```java java.util.Set deleted() ``` -------------------------------- ### take Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Retrieves and removes the next watch key, blocking indefinitely if necessary. ```APIDOC ## take() ### Description Retrieves and removes the next watch key, blocking indefinitely if necessary. ### Method `public java.nio.file.WatchKey take()` ### Implements `take` in interface `java.nio.file.WatchService` ### Throws `java.lang.InterruptedException` ``` -------------------------------- ### Get Modified Entries Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSet.html Retrieves a set of `ChangeSetEntry` objects representing files that were modified. ```java java.util.Set modified() ``` -------------------------------- ### PathUtils Static Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Utility methods for path manipulation and initialization. ```APIDOC ## PathUtils ### Static Methods #### `hash(FileHasher, Path)` **Description**: Computes the hash for a given file path using a specified hasher. #### `initWatcherState(List, FileHasher, FileTreeVisitor, Map, Set)` **Description**: Initializes the watcher state with provided paths and configurations. ``` -------------------------------- ### File Tree Visitor Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Provides the file tree visitor used to find files. If null, the default file visitor is used. ```java default FileTreeVisitor fileTreeVisitor() ``` -------------------------------- ### Instance Method: asString Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHash.html Provides a human-readable string representation of the file hash. ```java default java.lang.String asString() ``` -------------------------------- ### DirectoryChangeEvent.EventType CREATE Constant Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.EventType.html Represents the creation of a file or directory. ```java public static final DirectoryChangeEvent.EventType CREATE ``` -------------------------------- ### FSEventStreamCreate Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Creates a file system event stream. This is the primary method for setting up directory watching. ```java FSEventStreamRef FSEventStreamCreate(com.sun.jna.Pointer v, CarbonAPI.FSEventStreamCallback callback, com.sun.jna.Pointer context, CFArrayRef pathsToWatch, long sinceWhen, double latency, int flags) ``` -------------------------------- ### DefaultFileTreeVisitor Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/DefaultFileTreeVisitor.html Initializes a new instance of the DefaultFileTreeVisitor class. ```APIDOC ## DefaultFileTreeVisitor() ### Description Constructs a new DefaultFileTreeVisitor. ### Constructor `DefaultFileTreeVisitor()` ``` -------------------------------- ### Get Hash Value as Little-Endian Bytes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Returns the hash value as a byte array in little-endian order. ```java public byte[] getValueBytesLittleEndian() ``` -------------------------------- ### Set multiple paths to watch Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Use this method to specify a list of directories that the watcher should monitor for changes. ```java public DirectoryWatcher.Builder paths(java.util.List paths) ``` -------------------------------- ### Initialize Watcher State Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/PathUtils.html Initializes the state for the directory watcher, including setting up roots, hashers, visitors, and tracking directories. This method may throw an IOException. ```java public static void initWatcherState(java.util.List roots, FileHasher fileHasher, FileTreeVisitor fileTreeVisitor, java.util.Map hashes, java.util.Set directories) throws java.io.IOException ``` -------------------------------- ### Get Hash Value as Big-Endian Bytes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Returns the hash value as a byte array in big-endian order. ```java public byte[] getValueBytesBigEndian() ``` -------------------------------- ### Get Higher 64 Bits of Hash Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Retrieves the higher 64 bits of the 128-bit hash value. ```java public long getValueHigh() ``` -------------------------------- ### MacOSXListeningWatchService Default Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Constructs a new MacOSXListeningWatchService with default settings. This is a convenient option for standard usage. ```java public MacOSXListeningWatchService() ``` -------------------------------- ### Get Current Hash Value Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Returns the current hash value as a long. This method is part of the Checksum interface. ```java public long getValue() ``` -------------------------------- ### DefaultFileTreeVisitor Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/DefaultFileTreeVisitor.html Initializes a new instance of the DefaultFileTreeVisitor class. This is the default constructor. ```java public DefaultFileTreeVisitor() ``` -------------------------------- ### MacOSXListeningWatchService.Config Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/package-summary.html Configuration for the watch service, likely used to customize its behavior on macOS. ```APIDOC ## Class MacOSXListeningWatchService.Config ### Description Configuration for the watch service. ### Class `MacOSXListeningWatchService.Config` ``` -------------------------------- ### Get Current Run Loop - CarbonAPI Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Retrieves the reference to the current run loop. This is a fundamental operation for managing event processing. ```Objective-C CFRunLoopRef CFRunLoopGetCurrent() ``` -------------------------------- ### PathUtils Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/PathUtils.html Provides utility methods for file system operations, including hashing, directory traversal, and watch event casting. ```APIDOC ## PathUtils Provides utility methods for file system operations. ### Methods #### `static WatchEvent cast(WatchEvent event)` Casts a WatchEvent to a specific generic type. #### `static SortedMap createHashCodeMap(Path file, FileHasher fileHasher, FileTreeVisitor fileTreeVisitor) throws IOException` Creates a map of file paths to their corresponding FileHash within a given directory. #### `static FileHash hash(FileHasher fileHasher, Path path)` Computes the hash of a given file. #### `static void initWatcherState(List roots, FileHasher fileHasher, FileTreeVisitor fileTreeVisitor, Map hashes, Set directories) throws IOException` Initializes the watcher state, populating the provided maps and sets with file information. #### `static Set recursiveListFiles(FileTreeVisitor fileTreeVisitor, Path file) throws IOException` Recursively lists all files within a given directory. #### `static Iterable subtreePaths(SortedMap pathMap, Path treeRoot)` Returns an iterable of paths that are descendants of a given tree root within a path map. ``` -------------------------------- ### MacOSXListeningWatchService Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html A watch service implementation for macOS using Carbon API. ```APIDOC ## close() ### Description Closes the macOS listening watch service and releases resources. ### Method `close()` ### Class `io.methvin.watchservice.MacOSXListeningWatchService` ``` ```APIDOC ## close(MacOSXListeningWatchService.CFRunLoopThread, CarbonAPI.FSEventStreamCallback, Path) ### Description Closes the watch service with specific parameters related to the run loop thread, callback, and path. ### Method `close(MacOSXListeningWatchService.CFRunLoopThread thread, CarbonAPI.FSEventStreamCallback callback, Path path)` ### Class `io.methvin.watchservice.MacOSXListeningWatchService` ``` -------------------------------- ### Get Hash Value as Hex String Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Returns the hash value as a hexadecimal string, padded with leading zeros to a length of 32 characters. ```java public java.lang.String getValueHexString() ``` -------------------------------- ### ChangeSetEntry Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSetEntry.html This section details the public methods available on the ChangeSetEntry class, allowing users to retrieve information about a file change. ```APIDOC ## path ### Description Retrieves the path of the file or directory associated with this change set entry. ### Method ```java public java.nio.file.Path path() ``` ## isDirectory ### Description Checks if the entry represents a directory. ### Method ```java public boolean isDirectory() ``` ## hash ### Description Retrieves the hash of the file content for this change set entry. ### Method ```java public FileHash hash() ``` ## rootPath ### Description Retrieves the root path associated with this change set entry. ### Method ```java public java.nio.file.Path rootPath() ``` ## equals ### Description Compares this ChangeSetEntry to another object for equality. ### Method ```java public boolean equals(java.lang.Object o) ``` ### Overrides `equals` in class `java.lang.Object` ## hashCode ### Description Returns a hash code value for the object. ### Method ```java public int hashCode() ``` ### Overrides `hashCode` in class `java.lang.Object` ``` -------------------------------- ### Get Subtree Paths Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/PathUtils.html Retrieves an iterable of paths that are descendants of a given tree root from a path map. Useful for navigating directory structures. ```java public static java.lang.Iterable subtreePaths(java.util.SortedMap pathMap, java.nio.file.Path treeRoot) ``` -------------------------------- ### Watch Directories Asynchronously Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Asynchronously watch directories using the common ForkJoinPool. ```APIDOC ## watchAsync ### Description Asynchronously watch the directories using `ForkJoinPool.commonPool()` as the executor. ### Method `public CompletableFuture watchAsync()` ``` -------------------------------- ### DefaultFileTreeVisitor Instance Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.html Provides a default implementation of FileTreeVisitor that utilizes Files.walkFileTree. This is the standard way to traverse file trees. ```java static final FileTreeVisitor DEFAULT_FILE_TREE_VISITOR ``` -------------------------------- ### WatchablePath Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/WatchablePath.html Constructs a new WatchablePath instance. ```APIDOC ## WatchablePath Constructor ### Description Constructs a new WatchablePath instance. ### Parameters #### Path Parameter - **file** (java.nio.file.Path) - The Path to be wrapped. ``` -------------------------------- ### CFRunLoopThread run Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.CFRunLoopThread.html The main execution method for the CFRunLoopThread. This method is specified by the Runnable interface and overrides the default Thread run method. It is responsible for starting and managing the CFRunLoop. ```java public void run() ``` -------------------------------- ### DirectoryWatcher Builder Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Methods available on the DirectoryWatcher builder to configure and create a watcher instance. ```APIDOC ## DirectoryWatcher.Builder ### Methods #### `listener(DirectoryChangeListener)` **Description**: Set a listener that will be called when a directory change event occurs. #### `logger(Logger)` **Description**: Set a logger to be used by the watcher. ``` -------------------------------- ### MacOSXListeningWatchService.Config Constants Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/constant-values.html Provides access to configuration constants for the MacOSXListeningWatchService. ```APIDOC ## io.methvin.watchservice.MacOSXListeningWatchService.Config ### Description Constants related to the configuration of the MacOSXListeningWatchService. ### Fields - **DEFAULT_LATENCY** (double) - The default latency value. - **DEFAULT_QUEUE_SIZE** (int) - The default queue size value. ``` -------------------------------- ### Instance Method: asBytes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHash.html Returns the file hash as a byte array. ```java byte[] asBytes() ``` -------------------------------- ### toString() Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns a string representation of the DirectoryChangeEvent. ```APIDOC ## toString() ### Description Returns a string representation of the `DirectoryChangeEvent` object, including its event type, path, and other relevant details. ### Returns * **java.lang.String** - A string representation of the event. ``` -------------------------------- ### DirectoryWatcher Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Core methods for interacting with a DirectoryWatcher instance. ```APIDOC ## DirectoryWatcher ### Methods #### `getListener()` **Description**: Retrieves the currently set directory change listener. #### `isClosed()` **Description**: Checks if the watcher has been closed. ``` -------------------------------- ### Set a listener for directory change events Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Configure a listener that will be invoked whenever a change occurs in the watched directories. ```java public DirectoryWatcher.Builder listener(DirectoryChangeListener listener) ``` -------------------------------- ### Define a custom file tree visitor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Set a custom FileTreeVisitor to be used by the watcher for traversing file trees. ```java public DirectoryWatcher.Builder fileTreeVisitor(FileTreeVisitor fileTreeVisitor) ``` -------------------------------- ### toString Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/WatchablePath.html Returns a string representation of the WatchablePath. ```APIDOC ## toString Method ### Description Returns a string representation of the WatchablePath. ### Returns - **java.lang.String** - A string representation of the WatchablePath. ``` -------------------------------- ### Default Queue Size Configuration Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Specifies the default size of the queue used for each WatchKey. ```java static final int DEFAULT_QUEUE_SIZE ``` -------------------------------- ### FileTreeVisitor.Callback Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Callback interface for file tree traversal. ```APIDOC ## call(Path) ### Description This method is called for each path during the file tree traversal. ### Method `call(Path path)` ### Interface `io.methvin.watcher.visitor.FileTreeVisitor.Callback` ``` -------------------------------- ### DirectoryWatcher Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Constructs a DirectoryWatcher with specified paths, listener, watch service, file hasher, file tree visitor, and logger. ```java public DirectoryWatcher(java.util.List paths, DirectoryChangeListener listener, java.nio.file.WatchService watchService, FileHasher fileHasher, FileTreeVisitor fileTreeVisitor, org.slf4j.Logger logger) ``` -------------------------------- ### DirectoryChangeListener.of() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeListener.html Creates a DirectoryChangeListener that aggregates multiple listeners. Useful for combining different event handlers. ```java static DirectoryChangeListener of(DirectoryChangeListener... listeners) ``` -------------------------------- ### MacOSXListeningWatchService.Config Interface Definition Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Defines the configuration interface for the MacOSXListeningWatchService. ```java public static interface MacOSXListeningWatchService.Config ``` -------------------------------- ### FileHash Interface Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHash.html This section details the static and default methods available on the FileHash interface for creating and retrieving file hash representations. ```APIDOC ## Static Methods ### `fromBytes(byte[] value)` Creates a FileHash from a byte array. ### `fromLong(long value)` Creates a FileHash from a long value. ### `directory()` Returns a special FileHash instance representing a directory. ## Default Methods ### `asString()` Returns a human-readable string representation of the file hash. ### `asBytes()` Returns the file hash as a byte array. ``` -------------------------------- ### DirectoryChangeListener Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeListener.html This section details the methods available for the DirectoryChangeListener interface. ```APIDOC ## DirectoryChangeListener A listener that is called when file change events occur or when exceptions occur while watching. ### Methods * **`static DirectoryChangeListener of(DirectoryChangeListener... listeners)`** Creates a composite listener from multiple listeners. * **`void onEvent(DirectoryChangeEvent event)`** This method is called when a file change event occurs. Throws: `java.io.IOException` * **`default boolean isWatching()`** The watcher will stop watching after this method returns false. * **`default void onIdle(int count)`** This method is called when the watcher is idle. * **`default void onException(java.lang.Exception e)`** A handler for uncaught exceptions. Throwing an exception from here will terminate the watcher. ``` -------------------------------- ### CarbonAPI Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html This section details the various methods provided by the CarbonAPI interface for interacting with the Carbon framework. These methods are primarily used for creating and managing file system event streams and run loops. ```APIDOC ## CFArrayCreate ### Description Creates a Core Foundation array. ### Method `CFArrayRef CFArrayCreate(CFAllocatorRef allocator, com.sun.jna.Pointer[] values, CFIndex numValues, java.lang.Void callBacks)` ## CFRunLoopGetCurrent ### Description Gets the current run loop. ### Method `CFRunLoopRef CFRunLoopGetCurrent()` ## CFRunLoopRun ### Description Runs the current run loop. ### Method `void CFRunLoopRun()` ## CFRunLoopStop ### Description Stops the specified run loop. ### Method `void CFRunLoopStop(CFRunLoopRef runLoopRef)` ## CFStringCreateWithCharacters ### Description Creates a Core Foundation string from characters. ### Method `CFStringRef CFStringCreateWithCharacters(java.lang.Void alloc, char[] chars, CFIndex numChars)` ## FSEventStreamCreate ### Description Creates a file system event stream. ### Method `FSEventStreamRef FSEventStreamCreate(com.sun.jna.Pointer v, CarbonAPI.FSEventStreamCallback callback, com.sun.jna.Pointer context, CFArrayRef pathsToWatch, long sinceWhen, double latency, int flags)` ## FSEventStreamInvalidate ### Description Invalidates the file system event stream. ### Method `void FSEventStreamInvalidate(FSEventStreamRef streamRef)` ## FSEventStreamRelease ### Description Releases the file system event stream. ### Method `void FSEventStreamRelease(FSEventStreamRef streamRef)` ## FSEventStreamScheduleWithRunLoop ### Description Schedules the file system event stream with a run loop. ### Method `void FSEventStreamScheduleWithRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode)` ## FSEventStreamStart ### Description Starts the file system event stream. ### Method `boolean FSEventStreamStart(FSEventStreamRef streamRef)` ## FSEventStreamStop ### Description Stops the file system event stream. ### Method `void FSEventStreamStop(FSEventStreamRef streamRef)` ## FSEventStreamUnscheduleFromRunLoop ### Description Unschedule the file system event stream from a run loop. ### Method `void FSEventStreamUnscheduleFromRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode)` ``` -------------------------------- ### getFile Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/WatchablePath.html Returns the underlying Path object. ```APIDOC ## getFile Method ### Description Returns the underlying Path object. ### Returns - **java.nio.file.Path** - The wrapped Path object. ``` -------------------------------- ### DirectoryWatcher.Builder Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Provides a builder for creating a DirectoryWatcher instance. ```APIDOC ## build() ### Description Builds a new `DirectoryWatcher` instance using the configurations set in the builder. ### Method `build()` ### Class `io.methvin.watcher.DirectoryWatcher.Builder` ``` -------------------------------- ### DirectoryChangeEvent Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Methods for accessing information about directory change events. ```APIDOC ## DirectoryChangeEvent ### Methods #### `getWatchEventKind()` **Description**: Returns the type of watch event. #### `isDirectory()` **Description**: Checks if the event pertains to a directory. ``` -------------------------------- ### register Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Registers a watchable path with the service to monitor for specified events. ```APIDOC ## register(WatchablePath watchable, Iterable> events) ### Description Registers the given watchable with this service, returning a new watch key for it. This implementation just checks that the service is open and creates a key; subclasses may override it to do other things as well. ### Method `public io.methvin.watchservice.AbstractWatchKey register(WatchablePath watchable, java.lang.Iterable> events)` ### Throws `java.io.IOException` ``` -------------------------------- ### DirectoryChangeEvent Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Constructs a new DirectoryChangeEvent with the specified details. ```APIDOC ## DirectoryChangeEvent Constructor ### Description Initializes a new instance of the `DirectoryChangeEvent` class. ### Parameters * **eventType** (DirectoryChangeEvent.EventType) - The type of the directory event. * **isDirectory** (boolean) - Indicates if the event pertains to a directory. * **path** (java.nio.file.Path) - The path associated with the event. * **hash** (FileHash) - The hash of the file or directory, if applicable. * **count** (int) - A counter for the event. * **rootPath** (java.nio.file.Path) - The root path being watched. ``` -------------------------------- ### DirectoryWatcher.Builder Class Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/package-summary.html A builder class for configuring and creating instances of DirectoryWatcher. ```APIDOC ## Class: DirectoryWatcher.Builder ### Description A builder for a `DirectoryWatcher`. Allows for configuration of the watcher before instantiation. ### Methods (Specific builder methods are not detailed in the provided source.) ``` -------------------------------- ### Config Interface Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html The Config interface provides methods to configure various aspects of the watch service, including latency, queue size, file-level events, file hashing, and file tree visiting. ```APIDOC ## Interface MacOSXListeningWatchService.Config Configuration for the watch service. ### Fields - **DEFAULT_LATENCY** (double): Default latency setting. - **DEFAULT_QUEUE_SIZE** (int): Default queue size setting. ### Methods - **latency()** (double): The maximum number of seconds to wait after hearing about an event. - **queueSize()** (int): The size of the queue used for each WatchKey. - **fileLevelEvents()** (boolean): Request file-level notifications from the watcher. This can be expensive so use with care. NOTE: this feature will automatically be enabled when the file hasher is null, since the hasher is needed to determine which files in a directory were actually created or modified. - **fileHasher()** (FileHasher): The file hasher to use to check whether files have changed. If null, this will disable file hashing and automatically turn on file-level events. See `fileLevelEvents` config for more information. - **fileTreeVisitor()** (FileTreeVisitor): The file tree visitor to use in order to find files. If null, the default file visitor will be used. ``` -------------------------------- ### getFile Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/WatchablePath.html Returns the underlying java.nio.file.Path associated with this WatchablePath. ```java public java.nio.file.Path getFile() ``` -------------------------------- ### Set a single path to watch Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Use this method to specify a single directory that the watcher should monitor for changes. ```java public DirectoryWatcher.Builder path(java.nio.file.Path path) ``` -------------------------------- ### WatchablePath Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/WatchablePath.html Constructs a new WatchablePath instance for the given file path. ```java public WatchablePath(java.nio.file.Path file) ``` -------------------------------- ### MacOSXListeningWatchService Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/package-summary.html The primary implementation class for the Watch Service API on macOS. ```APIDOC ## Class MacOSXListeningWatchService ### Description This class contains the bulk of my implementation of the Watch Service API. ### Class `MacOSXListeningWatchService` ``` -------------------------------- ### FileTreeVisitor.Callback.call Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.Callback.html The 'call' method is the core of the Callback interface. It is executed for every Path visited in the file tree. Implementations of this method can perform actions such as logging, filtering, or processing the file. ```APIDOC ## call ### Description This method is invoked for each path encountered during a file tree traversal. ### Method Signature `void call(java.nio.file.Path p)` ### Parameters * **p** (java.nio.file.Path) - The path of the file or directory being visited. ### Throws * `java.io.IOException` - If an I/O error occurs during processing. ``` -------------------------------- ### DirectoryChangeListener Interface Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Interface for listening to directory change events. ```APIDOC ## DirectoryChangeListener ### Methods #### `isWatching()` **Description**: The watcher will stop watching after this method returns false. ``` -------------------------------- ### hash() Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Retrieves the hash of the file or directory. ```APIDOC ## hash() ### Description Returns the hash of the file or directory involved in the event, if available. ### Returns * **FileHash** - The hash object. ``` -------------------------------- ### FSEventStreamScheduleWithRunLoop Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Schedules a file system event stream with a Core Foundation run loop. This is necessary for the stream to process events. ```java void FSEventStreamScheduleWithRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode) ``` -------------------------------- ### hashCode() Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns a hash code value for the DirectoryChangeEvent. ```APIDOC ## hashCode() ### Description Returns a hash code value for this `DirectoryChangeEvent`, supported for the benefit of hash tables. ### Returns * **int** - a hash code value for this object. ``` -------------------------------- ### Define a custom file hasher Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Specify a custom FileHasher implementation. This will implicitly enable file hashing. Setting to null is equivalent to calling fileHashing(false). ```java public DirectoryWatcher.Builder fileHasher(FileHasher fileHasher) ``` -------------------------------- ### FileTreeVisitor Interface Definition Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.html Defines the contract for visiting file trees. It has a nested Callback interface for handling directory and file events. ```java public interface FileTreeVisitor ``` -------------------------------- ### ChangeSetListener Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSetListener.html Initializes a new instance of the ChangeSetListener class. ```APIDOC ## ChangeSetListener() ### Description Initializes a new instance of the ChangeSetListener class. ### Method ```java public ChangeSetListener() ``` ``` -------------------------------- ### recursiveVisitFiles Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.html Recursively visits files in a directory, applying callbacks for directories and files. ```APIDOC ## Method: recursiveVisitFiles ### Description Recursively visits files in a directory, applying callbacks for directories and files. ### Signature `void recursiveVisitFiles(java.nio.file.Path file, FileTreeVisitor.Callback onDirectory, FileTreeVisitor.Callback onFile)` ### Parameters - **file** (java.nio.file.Path) - The starting path for the recursive visit. - **onDirectory** (FileTreeVisitor.Callback) - The callback to invoke for each directory encountered. - **onFile** (FileTreeVisitor.Callback) - The callback to invoke for each file encountered. ### Throws - `java.io.IOException` - If an I/O error occurs during file traversal. ``` -------------------------------- ### recursiveVisitFiles Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/DefaultFileTreeVisitor.html Recursively visits files in a directory, applying callbacks for directories and files. ```APIDOC ## recursiveVisitFiles ### Description Recursively visits files starting from the given file path. It applies the `onDirectory` callback for directories and the `onFile` callback for files. ### Method Signature `void recursiveVisitFiles(java.nio.file.Path file, FileTreeVisitor.Callback onDirectory, FileTreeVisitor.Callback onFile)` ### Parameters - **file** (java.nio.file.Path) - The starting path for the recursive visit. - **onDirectory** (FileTreeVisitor.Callback) - The callback to execute for each directory encountered. - **onFile** (FileTreeVisitor.Callback) - The callback to execute for each file encountered. ### Throws - `java.io.IOException` - If an I/O error occurs during the file traversal. ``` -------------------------------- ### Set a custom WatchService implementation Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.Builder.html Provide a specific WatchService implementation. If not set, the watcher defaults to using the native JVM watcher or the macOS watcher based on the operating system. ```java public DirectoryWatcher.Builder watchService(java.nio.file.WatchService watchService) ``` -------------------------------- ### FileTreeVisitor.Callback Interface Definition Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.Callback.html Defines the structure of a callback for file tree visitation. Implement this interface to process each file path visited. ```java public static interface FileTreeVisitor.Callback ``` -------------------------------- ### DirectoryWatcher Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Represents the main class for watching directory changes. ```APIDOC ## builder() ### Description Get a new builder for a `DirectoryWatcher`. ### Method `builder()` ### Class `io.methvin.watcher.DirectoryWatcher` ``` ```APIDOC ## close() ### Description Closes the `DirectoryWatcher` and releases any associated resources. ### Method `close()` ### Class `io.methvin.watcher.DirectoryWatcher` ``` -------------------------------- ### onFailure Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/DefaultFileTreeVisitor.html Handles failures that occur during file tree traversal. ```APIDOC ## onFailure ### Description This protected method is called when an `IOException` occurs during the file tree traversal for a specific path. ### Method Signature `protected void onFailure(java.nio.file.Path path, java.io.IOException exception)` ### Parameters - **path** (java.nio.file.Path) - The path that caused the failure. - **exception** (java.io.IOException) - The exception that occurred. ### Throws - `java.io.IOException` - Can be thrown if the implementation re-throws the exception or performs operations that might throw an IOException. ``` -------------------------------- ### isOpen Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Checks if the watch service is currently open. ```APIDOC ## isOpen() ### Description Returns whether or not this watch service is open. ### Method `public boolean isOpen()` ``` -------------------------------- ### DirectoryChangeListener Interface Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Defines methods for handling directory change events, exceptions, and idle notifications. ```APIDOC ## DirectoryChangeListener ### Methods - **onEvent(DirectoryChangeEvent)**: Called when a directory event occurs. - **onException(Exception)**: A handler for uncaught exceptions. - **onIdle(int)**: Called when the watcher is idle after a specified number of events. ``` -------------------------------- ### Register Watchable Path Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.html Registers a watchable path with the service to monitor for file system events. Subclasses may override this to add custom logic. ```java public io.methvin.watchservice.AbstractWatchKey register(WatchablePath watchable, java.lang.Iterable> events) throws java.io.IOException ``` -------------------------------- ### DirectoryChangeEvent Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Constructs a new DirectoryChangeEvent. This is used internally by the watcher to represent file system events. ```java public DirectoryChangeEvent(DirectoryChangeEvent.EventType eventType, boolean isDirectory, java.nio.file.Path path, FileHash hash, int count, java.nio.file.Path rootPath) ``` -------------------------------- ### DirectoryChangeEvent toString() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns a string representation of the DirectoryChangeEvent. Overrides the default Object.toString() method. ```java public java.lang.String toString() ``` -------------------------------- ### CarbonAPI Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Interface for interacting with the Carbon API on macOS. ```APIDOC ## CFArrayCreate(CFAllocatorRef, Pointer[], CFIndex, Void) ### Description Creates a new Core Foundation array. ### Method `CFArrayCreate(CFAllocatorRef allocator, Pointer[] values, CFIndex numValues, Void type)` ### Interface `io.methvin.watchservice.jna.CarbonAPI` ``` ```APIDOC ## CFRunLoopGetCurrent() ### Description Gets the current run loop. ### Method `CFRunLoopGetCurrent()` ### Interface `io.methvin.watchservice.jna.CarbonAPI` ``` ```APIDOC ## CFRunLoopRun() ### Description Runs the current run loop. ### Method `CFRunLoopRun()` ### Interface `io.methvin.watchservice.jna.CarbonAPI` ``` ```APIDOC ## CFRunLoopStop(CFRunLoopRef) ### Description Stops the specified run loop. ### Method `CFRunLoopStop(CFRunLoopRef runLoop)` ### Interface `io.methvin.watchservice.jna.CarbonAPI` ``` ```APIDOC ## CFStringCreateWithCharacters(Void, char[], CFIndex) ### Description Creates a new Core Foundation string from characters. ### Method `CFStringCreateWithCharacters(Void allocator, char[] chars, CFIndex numChars)` ### Interface `io.methvin.watchservice.jna.CarbonAPI` ``` -------------------------------- ### Callback Method Signature Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.Callback.html The abstract method that must be implemented by subclasses. It receives the Path of the visited file and can throw an IOException. ```java void call(java.nio.file.Path p) throws java.io.IOException ``` -------------------------------- ### Default FileHasher Instance Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHasher.html Provides the default file hasher instance, which utilizes the Murmur3 hashing algorithm for content comparison. ```java static final FileHasher DEFAULT_FILE_HASHER ``` -------------------------------- ### Queue Size Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Retrieves the size of the queue used for each WatchKey. ```java default int queueSize() ``` -------------------------------- ### CFIndex Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CFIndex.html Constructs a new CFIndex object. This is a default constructor. ```APIDOC ## CFIndex() ### Description Constructs a new CFIndex object. ### Constructor `public CFIndex()` ``` -------------------------------- ### DirectoryChangeListener.onException() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeListener.html Handler for uncaught exceptions during watching. Throwing an exception from here will terminate the watcher. ```java default void onException(java.lang.Exception e) ``` -------------------------------- ### Static Factory Method: directory Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHash.html Returns the special FileHash instance representing a directory. ```java static FileHash directory() ``` -------------------------------- ### Murmur3F Constructors Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Provides constructors for initializing the Murmur3F hash function. You can create an instance with a default seed or provide a custom seed. ```APIDOC ## Murmur3F() ### Description Initializes a new instance of the Murmur3F class with a default seed. ### Constructor ```java public Murmur3F() ``` ``` ```APIDOC ## Murmur3F(int seed) ### Description Initializes a new instance of the Murmur3F class with a specified seed. ### Constructor ```java public Murmur3F(int seed) ``` ``` -------------------------------- ### CFAllocatorRef Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CFAllocatorRef.html Initializes a new instance of the CFAllocatorRef class. This constructor is used to create a reference to a Core Foundation allocator. ```java public CFAllocatorRef() ``` -------------------------------- ### FSEventStreamRef Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/FSEventStreamRef.html This section describes the constructor for the FSEventStreamRef class. ```APIDOC ## FSEventStreamRef() ### Description Constructs a new FSEventStreamRef. ### Method ```java public FSEventStreamRef() ``` ``` -------------------------------- ### CFAllocatorRef Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CFAllocatorRef.html Initializes a new instance of the CFAllocatorRef class. This constructor is part of the public API for creating CFAllocatorRef objects. ```APIDOC ## CFAllocatorRef() ### Description Constructs a new CFAllocatorRef object. ### Method ```java public CFAllocatorRef() ``` ``` -------------------------------- ### DirectoryChangeEvent hash() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns the FileHash associated with the event, if available. This can be used to detect content changes. ```java public FileHash hash() ``` -------------------------------- ### WatchablePath Class Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/index-all.html Represents a path that can be registered with a WatchService. ```APIDOC ## WatchablePath ### Methods - **register(WatchService, WatchEvent.Kind[], WatchEvent.Modifier...)**: Registers the path with a WatchService. - **register(WatchService, WatchEvent.Kind...)**: Registers the path with a WatchService. ``` -------------------------------- ### DirectoryChangeEvent Class Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/package-summary.html Represents an event that occurs within a directory being watched. ```APIDOC ## Class: DirectoryChangeEvent ### Description Represents a change event occurring in a watched directory. ### Fields (No specific fields are detailed in the provided source.) ``` -------------------------------- ### WatchablePath Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/package-summary.html Represents a path that can be watched for changes. ```APIDOC ## Interface WatchablePath ### Description Represents a path that can be watched for changes. ### Interface `WatchablePath` ``` -------------------------------- ### DirectoryChangeEvent path() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns the java.nio.file.Path representing the file or directory that triggered the event. ```java public java.nio.file.Path path() ``` -------------------------------- ### DirectoryChangeListener.isWatching() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeListener.html Determines if the watcher should continue watching. Returning false will stop the watcher. ```java default boolean isWatching() ``` -------------------------------- ### CFRunLoopGetCurrent Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Retrieves the current Core Foundation run loop. Used for scheduling event streams. ```java CFRunLoopRef CFRunLoopGetCurrent() ``` -------------------------------- ### ChangeSet Methods Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSet.html This section details the methods available on the ChangeSet interface for accessing file change information. ```APIDOC ## created ### Description Returns a set of `ChangeSetEntry` objects representing files that have been created. ### Method created ### Returns `java.util.Set` - A set of created file entries. ## modified ### Description Returns a set of `ChangeSetEntry` objects representing files that have been modified. ### Method modified ### Returns `java.util.Set` - A set of modified file entries. ## deleted ### Description Returns a set of `ChangeSetEntry` objects representing files that have been deleted. ### Method deleted ### Returns `java.util.Set` - A set of deleted file entries. ``` -------------------------------- ### Watch Directories Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryWatcher.html Watch for changes; blocks until the listener stops or the watcher is closed. ```APIDOC ## watch ### Description Watch for changes; block until the listener stops listening or the watcher is closed. ### Method `public void watch()` ### Throws `java.lang.IllegalStateException` - if the directory watcher is closed when watch() is called. ``` -------------------------------- ### DirectoryChangeListener.onEvent() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeListener.html Callback method invoked when a file change event occurs. This method can throw IOException. ```java void onEvent(DirectoryChangeEvent event) throws java.io.IOException ``` -------------------------------- ### Murmur3F Constructor with Seed Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Initializes a new Murmur3F hash instance with a specified seed. ```java public Murmur3F(int seed) ``` -------------------------------- ### CFArrayRef Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CFArrayRef.html This section details the constructor for the CFArrayRef class. ```APIDOC ## CFArrayRef() ### Description Constructs a new CFArrayRef. ### Constructor `CFArrayRef()` ``` -------------------------------- ### File Level Events Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Requests file-level notifications from the watcher. This can be expensive, so use with care. This feature is automatically enabled when the file hasher is null. ```java default boolean fileLevelEvents() ``` -------------------------------- ### ChangeSetListener Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/changeset/ChangeSetListener.html Initializes a new instance of the ChangeSetListener class. This is the default constructor. ```java public ChangeSetListener() ``` -------------------------------- ### DirectoryChangeEvent count() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns the number of times this event has been observed. This can be useful for coalescing rapid changes. ```java public int count() ``` -------------------------------- ### File Hasher Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/MacOSXListeningWatchService.Config.html Provides the file hasher used to check for file changes. If null, file hashing is disabled and file-level events are automatically enabled. ```java default FileHasher fileHasher() ``` -------------------------------- ### CFRunLoopRef Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CFRunLoopRef.html This section details the constructor for the CFRunLoopRef class. ```APIDOC ## CFRunLoopRef() ### Description Constructs a new CFRunLoopRef. ### Constructor `CFRunLoopRef()` ``` -------------------------------- ### DEFAULT_FILE_TREE_VISITOR Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/visitor/FileTreeVisitor.html The default file tree visitor instance, which uses Files.walkFileTree for traversal. ```APIDOC ## Field: DEFAULT_FILE_TREE_VISITOR ### Description The default file tree visitor instance, which uses Files.walkFileTree. ### Type FileTreeVisitor ``` -------------------------------- ### Static Factory Method: fromBytes Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/FileHash.html Creates a FileHash instance from a byte array representation. ```java static FileHash fromBytes(byte[] value) ``` -------------------------------- ### DirectoryChangeEvent isDirectory() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Returns true if the event pertains to a directory, false if it pertains to a file. ```java public boolean isDirectory() ``` -------------------------------- ### DirectoryWatcher Class Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/package-summary.html The main class responsible for watching directories for changes. ```APIDOC ## Class: DirectoryWatcher ### Description Provides functionality to watch directories for file system changes. ### Usage (Specific usage examples are not provided in the source.) ``` -------------------------------- ### Murmur3F Constructor Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/hashing/Murmur3F.html Initializes a new Murmur3F hash instance with a default seed. ```java public Murmur3F() ``` -------------------------------- ### Recursively List Files Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/PathUtils.html Recursively lists all files within a given directory, using a FileTreeVisitor to process the directory structure. This method may throw an IOException. ```java public static java.util.Set recursiveListFiles(FileTreeVisitor fileTreeVisitor, java.nio.file.Path file) throws java.io.IOException ``` -------------------------------- ### CFRunLoopRun Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watchservice/jna/CarbonAPI.html Runs the current Core Foundation run loop. This method blocks until the run loop is stopped. ```java void CFRunLoopRun() ``` -------------------------------- ### DirectoryChangeListener Interface Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/package-summary.html A listener interface that is invoked when file change events occur or when exceptions arise during the watching process. ```APIDOC ## Interface: DirectoryChangeListener ### Description A listener that is called when file change events occur or when exceptions occur while watching. ### Methods (No specific methods are detailed in the provided source for direct invocation.) ### Events - File change events - Exception events during watching ``` -------------------------------- ### DirectoryChangeEvent equals() Method Source: https://javadoc.io/doc/io.methvin/directory-watcher/0.19.1/io/methvin/watcher/DirectoryChangeEvent.html Compares this DirectoryChangeEvent to another object for equality. Overrides the default Object.equals() method. ```java public boolean equals(java.lang.Object o) ```