Package name.pachler.nio.file.ext
Class ExtendedWatchEventKind
- java.lang.Object
-
- name.pachler.nio.file.ext.ExtendedWatchEventKind
-
public class ExtendedWatchEventKind extends java.lang.ObjectProvides non-standard watch event kinds that enable more specialized watch features.File rename tracking
TheENTRY_RENAME_FROMandENTRY_RENAME_TOevent kinds enable more fine grained file rename tracing. When only the standard event kinds are specified with Path.register(), renaming a file in a watched directory will only yield anStandardWatchEventKind.ENTRY_CREATEand anStandardWatchEventKind.ENTRY_DELETEevent, which makes it indistinguishable from actual file creation and deletion events. IfENTRY_RENAME_FROMand/orENTRY_RENAME_TOare specified, renamed files will be reported with respective events. Note that if bothENTRY_RENAME_FROMandENTRY_RENAME_TOare specified, aENTRY_RENAME_FROMevent for a file will be immediately be followed by aENTRY_RENAME_TOevent for the same file.
-
-
Field Summary
Fields Modifier and Type Field Description static WatchEvent.Kind<Path>ENTRY_RENAME_FROMIndicates the old file name of a renamed file.static WatchEvent.Kind<Path>ENTRY_RENAME_TOIndicates the new file name of a renamed file.static WatchEvent.Kind<java.lang.Void>KEY_INVALIDIndicates that the givenWatchKeyhas become invalid.
-
Constructor Summary
Constructors Constructor Description ExtendedWatchEventKind()
-
-
-
Field Detail
-
ENTRY_RENAME_FROM
public static WatchEvent.Kind<Path> ENTRY_RENAME_FROM
Indicates the old file name of a renamed file. TheWatchEvent'sWatchEvent.context()method will return a Path that indicates the previous name that the file had.
-
ENTRY_RENAME_TO
public static WatchEvent.Kind<Path> ENTRY_RENAME_TO
Indicates the new file name of a renamed file. TheWatchEvent'sWatchEvent.context()method will return a Path that indicates the new name of the file.
-
KEY_INVALID
public static WatchEvent.Kind<java.lang.Void> KEY_INVALID
Indicates that the givenWatchKeyhas become invalid. This can happen for a number of reasons:- The key has been invalidated programmatically by calling
WatchKey.cancel(). - The
WatchServicehas been closed. - The path that the key has been registered with has become unavailable, e.g because it was deleted or the file system on which it resides has been unmounted.
- The key has been invalidated programmatically by calling
-
-