Package name.pachler.nio.file.ext
Class ExtendedWatchEventKind
java.lang.Object
name.pachler.nio.file.ext.ExtendedWatchEventKind
Provides non-standard watch event kinds that enable more specialized
watch features.
File rename tracking
TheENTRY_RENAME_FROM
and ENTRY_RENAME_TO
event
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 an StandardWatchEventKind.ENTRY_CREATE
and an
StandardWatchEventKind.ENTRY_DELETE
event, which makes it indistinguishable from actual file creation and
deletion events.
If ENTRY_RENAME_FROM
and/or ENTRY_RENAME_TO
are
specified, renamed files will be reported with respective events. Note that
if both ENTRY_RENAME_FROM
and ENTRY_RENAME_TO
are specified, a ENTRY_RENAME_FROM
event for a file will
be immediately be followed by a ENTRY_RENAME_TO
event for the
same file.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic WatchEvent.Kind<Path>
Indicates the old file name of a renamed file.static WatchEvent.Kind<Path>
Indicates the new file name of a renamed file.static WatchEvent.Kind<Void>
Indicates that the givenWatchKey
has become invalid. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
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
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
Indicates that the givenWatchKey
has become invalid. This can happen for a number of reasons:- The key has been invalidated programmatically by calling
WatchKey.cancel()
. - The
WatchService
has 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
-
-
Constructor Details
-
ExtendedWatchEventKind
public ExtendedWatchEventKind()
-