Package name.pachler.nio.file.impl
Class PathWatchKey
- java.lang.Object
-
- name.pachler.nio.file.WatchKey
-
- name.pachler.nio.file.impl.PathWatchKey
-
- Direct Known Subclasses:
LinuxPathWatchKey
public class PathWatchKey extends WatchKey
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()This cancels the registration with the WatchService that this WatchKey was registered with.protected voidfinalize()protected intgetNumQueuedEvents()booleanisValid()java.util.List<WatchEvent<?>>pollEvents()Returns the events that have occurred for this WatchKey.booleanreset()Resets thisWatchKey(marks it as non-signalled) so that it's correspondingWatchServicecan report it again via it'sWatchService.poll()andWatchService.take()methods.
-
-
-
Method Detail
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.lang.Object
-
cancel
public void cancel()
Description copied from class:WatchKeyThis cancels the registration with the WatchService that this WatchKey was registered with. This means that no new events will be delivered to this key any more. Events that are pending can still be retreived with pollEvents(), and if the WatchKey is still marked as signalled a call to WatchService's poll() or take() functions will still return it.
-
isValid
public final boolean isValid()
-
pollEvents
public java.util.List<WatchEvent<?>> pollEvents()
Description copied from class:WatchKeyReturns the events that have occurred for this WatchKey. Just calling this method will not reset the signalled state of this key; you'll have to call #reset() to indicate to the WatchService that the the client is ready to receive more events and that the key can be re-queued. After the WatchService has determined that events have occurred for a registered Watchable represented by a given WatchKey, it will return that key when the client calls it's WatchService#take() or WatchService#poll() methods.- Specified by:
pollEventsin classWatchKey- Returns:
- a list of events that have occurred since the last time that #pollEvents() was called.
-
reset
public boolean reset()
Description copied from class:WatchKeyResets thisWatchKey(marks it as non-signalled) so that it's correspondingWatchServicecan report it again via it'sWatchService.poll()andWatchService.take()methods.- Specified by:
resetin classWatchKey- Returns:
trueif the key could be reset,falseotherwise (typically if the correspondingWatchServicehas been closed or if the the key was not signalled).
-
getNumQueuedEvents
protected int getNumQueuedEvents()
-
-