name.pachler.nio.file
Class WatchEvent<T>
java.lang.Object
name.pachler.nio.file.WatchEvent<T>
public abstract class WatchEvent<T>
- extends java.lang.Object
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 |
static interface |
WatchEvent.Kind<T>
Instances of this class act as tags to identify different kinds of
events (like file creation or deletion) |
static interface |
WatchEvent.Modifier<T>
A modifier can be specified to register to
change the way changes to a watchable are reported. jpathwatch
defines a set of modifiers in the ExtendedWatchEventModifier
class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
WatchEvent
protected WatchEvent()
context
public abstract T 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 watched Path
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
public abstract WatchEvent.Kind<T> 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.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object