WatchEvent (Java SE 9 & JDK 9 ) (original) (raw)
- Type Parameters:
T
- The type of the context object associated with the event
public interface WatchEvent
An event or a repeated event for an object that is registered with a WatchService.
An event is classified by its kind and has a count to indicate the number of times that the event has been observed. This allows for efficient representation of repeated events. Thecontext method returns any context associated with the event. In the case of a repeated event then the context is the same for all events.
Watch events are immutable and safe for use by multiple concurrent threads.
Since:
1.7
Nested Class Summary
Nested Classes
Modifier and Type Interface Description static interface WatchEvent.Kind<T> An event kind, for the purposes of identification. static interface WatchEvent.Modifier An event modifier that qualifies how a Watchable is registered with a WatchService. Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method Description T context() Returns the context for the event. int count() Returns the event count. WatchEvent.Kind<T> kind() Returns the event kind. Method Detail
* #### kind [WatchEvent.Kind](../../../java/nio/file/WatchEvent.Kind.html "interface in java.nio.file")<[T](../../../java/nio/file/WatchEvent.html "type parameter in WatchEvent")> kind() Returns the event kind. Returns: the event kind * #### count int count() Returns the event count. If the event count is greater than `1` then this is a repeated event. Returns: the event count * #### context [T](../../../java/nio/file/WatchEvent.html "type parameter in WatchEvent") context() Returns the context for the event. In the case of [ENTRY\_CREATE](../../../java/nio/file/StandardWatchEventKinds.html#ENTRY%5FCREATE),[ENTRY\_DELETE](../../../java/nio/file/StandardWatchEventKinds.html#ENTRY%5FDELETE), and [ENTRY\_MODIFY](../../../java/nio/file/StandardWatchEventKinds.html#ENTRY%5FMODIFY) events the context is a `Path` that is the [relative](../../../java/nio/file/Path.html#relativize-java.nio.file.Path-) path between the directory registered with the watch service, and the entry that is created, deleted, or modified. Returns: the event context; may be `null`
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.