Cancels the registration with the watch service.
Cancels the registration with the watch service. Upon return the watch key will be invalid. If the watch key is enqueued, waiting to be retrieved from the watch service, then it will remain in the queue until it is removed. Pending events, if any, remain pending and may be retrieved by invoking the pollEvents method after the key is cancelled. If this watch key has already been cancelled then invoking this method has no effect. Once cancelled, a watch key remains forever invalid.
Retrieves and removes all pending events for this watch key.
Retrieves and removes all pending events for this watch key.
This does not block, it will immediately return an empty list if there are no events pending. Typically, this key
should be reset after processing the returned events, the pollEventsScoped
method can be used to do this
automatically and reliably.
Retrieves and removes all pending events for this watch key as a scoped resource.
Retrieves and removes all pending events for this watch key as a scoped resource.
This does not block, it will immediately return an empty list if there are no events pending. When the Scope
is
closed, this key will be reset.
Resets this watch key, making it eligible to be re-queued in the WatchService
.
Resets this watch key, making it eligible to be re-queued in the WatchService
. A key is typically reset after all
the pending events retrieved from pollEvents
have been processed. Use pollEventsScop[ed
to automatically and
reliably perform a reset.
Convenience method to construct the complete path indicated by a WatchEvent
.
Convenience method to construct the complete path indicated by a WatchEvent
.
If both the following are true:
then this method returns a path with the event's path resolved against this key's path, (key path) / (event
path)
.
If either of the above conditions don't hold, None
is returned. The conditions will always hold when watching
file system paths.
Returns the object for which this watch key was created.
A token representing the registration of a watchable object with a
WatchService
.Java NIO API.