Package name.pachler.nio.file.ext
Class ExtendedWatchEventModifier
- java.lang.Object
-
- name.pachler.nio.file.ext.ExtendedWatchEventModifier
-
public class ExtendedWatchEventModifier extends java.lang.ObjectThis class holds non-standard modifiers that can be passed to Path.register(). Note that these might not be supported on all platforms, so specifying them toregistermight cause anUnsupportedOperationExceptionor anIllegalArgumentExceptionto be thrown.
-
-
Field Summary
Fields Modifier and Type Field Description static WatchEvent.Modifier<Path>ACCURATETheACCURATEmodifier indicates that the WatchKey may not miss events under any circumstances.static WatchEvent.Modifier<Path>FILE_TREETheFILE_TREEmodifier makes a WatchKey recursive.
-
Constructor Summary
Constructors Constructor Description ExtendedWatchEventModifier()
-
-
-
Field Detail
-
FILE_TREE
public static final WatchEvent.Modifier<Path> FILE_TREE
TheFILE_TREEmodifier makes a WatchKey recursive. Without this modifier, a file watch is shallow: For a watched directoryfoo, WatchEvents are only generated for direct children such asfoo/barorfoo/oof. For a changes to files in a subdirectory offoo, such asfoo/adir/filewill only be reported if theFILE_TREEmodifier is specified. Note that this modifier is only available on the Windows platform. If specified on other platforms, Path.register() will throw an UnsupportedOperationException.
-
ACCURATE
public static final WatchEvent.Modifier<Path> ACCURATE
TheACCURATEmodifier indicates that the WatchKey may not miss events under any circumstances. If aWatchServiceimplementation is based on polling it may miss files that are created and deleted between two polls of the key (see below how this can happen). TheACCURATEmodifier demands that no events may be missed, however, not all platforms support this. Note that even without specifying ACCURATE events are still guaranteed to be reported as symmetric - if bothENTRY_CREATEandENTRY_DELETEhave been specified, only whole pairs of creation/deletion can be missed, not just one of them. On some platforms, ACCURATE is implicit as the underlying operating system guarantees to deliver every event, even without specifyingACCURATE(however, the queue might still overflow, generating an event of theOVERFLOWkind) Consider the following scenario in which an implementation which does not support ACCURATE can miss events:
Say, at 0ms, the key polls, and detects no files in a directory. The key goes to sleep for 200ms. Say, at 50ms, a file is created. Then, at 100ms, the same file is deleted again. When the WatchKey wakes up after 200ms, it will see the same as it saw before: An empty directory.
-
-