public class ExtendedWatchEventModifier
extends java.lang.Object
register
might cause an
UnsupportedOperationException
or an IllegalArgumentException
to be thrown.Modifier and Type | Field and Description |
---|---|
static WatchEvent.Modifier<Path> |
ACCURATE
The
ACCURATE modifier indicates that the WatchKey may not miss events
under any circumstances.
If a WatchService implementation 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). |
static WatchEvent.Modifier<Path> |
FILE_TREE
The
FILE_TREE modifier makes a WatchKey recursive. |
Constructor and Description |
---|
ExtendedWatchEventModifier() |
public static final WatchEvent.Modifier<Path> FILE_TREE
FILE_TREE
modifier makes a WatchKey recursive. Without this modifier,
a file watch is shallow: For a watched directory foo
,
WatchEvents are only generated for direct children such as
foo/bar
or foo/oof
. For a changes to files in a
subdirectory of foo
, such as foo/adir/file
will only be reported if the FILE_TREE
modifier is specified.
Note that this modifier is only available on the Windows platform. If
specified on other platforms, Path.register() will throw an
UnsupportedOperationException.public static final WatchEvent.Modifier<Path> ACCURATE
ACCURATE
modifier indicates that the WatchKey may not miss events
under any circumstances.
If a WatchService
implementation 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). The ACCURATE
modifier 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 both ENTRY_CREATE
and ENTRY_DELETE
have 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 specifying
ACCURATE
(however, the queue might still overflow, generating
an event of the OVERFLOW
kind)
Consider the following scenario in which an implementation which
does not support ACCURATE can miss events: