Package io.methvin.watcher.hashing
Interface FileHasher
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface FileHasher
A function to convert a Path to a hash code used to check if the file content is changed. This is
called by DirectoryWatcher after checking that the path exists and is not a directory. Therefore
this hasher can generally assume that those two things are true.
By default, this hasher may throw an IOException, which will be treated as a `null` hash by the watcher, meaning the associated event will be ignored. If you want to handle that exception you can catch/rethrow it.
-
Field Summary
Fields Modifier and Type Field Description static FileHasher
DEFAULT_FILE_HASHER
The default file hasher instance, which uses Murmur3.static FileHasher
LAST_MODIFIED_TIME
A file hasher that returns the last modified time provided by the OS. -
Method Summary
-
Field Details
-
DEFAULT_FILE_HASHER
The default file hasher instance, which uses Murmur3. -
LAST_MODIFIED_TIME
A file hasher that returns the last modified time provided by the OS.This only works reliably on certain file systems and JDKs that support at least millisecond-level precision.
-
-
Method Details
-
hash
- Throws:
java.io.IOException
-