Package name.pachler.nio.file
Class WatchEvent<T>
java.lang.Object
name.pachler.nio.file.WatchEvent<T>
- Direct Known Subclasses:
PathWatchEvent
,VoidWatchEvent
Instances of this class hold the information of a particular change to
an element below the watched file system object (e.g. a file modification
or a rename). These objects can be retreived from a WatchKey once it has
been returned by the WatchService (using the
poll()
or
take()
methods).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Instances of this class act as tags to identify different kinds of events (like file creation or deletion)static interface
A modifier can be specified toregister
to change the way changes to a watchable are reported. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WatchEvent
protected WatchEvent()
-
-
Method Details
-
context
- Returns:
- the context of this event, which is usually a reference to the
object that has changed. In the case of WatchEvents for Path, the
context will be a
Path
to the file that this event refers to, relative to the watchedPath
-
count
public abstract int count()The number of times this event occurred, if it is cumulative. It is not specified how events cumulate, so use this value for informational purposes only.- Returns:
- the number of times this event has occurred, in case events of this kind have been aggregated into one WatchEvent instance.
-
kind
- Returns:
- the kind of event that occurred. This will indicate what actually happened, for instance, StandardWatchEventKind#ENTRY_CREATE indicates that a file has been created.
-