public class TestWatchDirectory
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.nio.file.WatchKey,java.nio.file.Path> |
keys |
private boolean |
recursive |
private static long |
serialVersionUID
The class' serialization version id.
|
private boolean |
trace |
private java.nio.file.WatchService |
watcher |
Constructor and Description |
---|
TestWatchDirectory(java.nio.file.Path dir,
boolean recursive)
Creates a WatchService and registers the given directory
|
Modifier and Type | Method and Description |
---|---|
(package private) static <T> java.nio.file.WatchEvent<T> |
cast(java.nio.file.WatchEvent<?> event) |
static void |
main(java.lang.String[] args) |
protected void |
processEvents()
Process all events for keys queued to the watcher
|
protected void |
register(java.nio.file.Path dir)
Register the given directory with the WatchService
|
protected void |
registerAll(java.nio.file.Path start)
Register the given directory, and all its sub-directories, with the
WatchService.
|
(package private) static void |
usage() |
private static final long serialVersionUID
private final java.nio.file.WatchService watcher
private final java.util.Map<java.nio.file.WatchKey,java.nio.file.Path> keys
private final boolean recursive
private boolean trace
TestWatchDirectory(java.nio.file.Path dir, boolean recursive) throws java.io.IOException
java.io.IOException
static <T> java.nio.file.WatchEvent<T> cast(java.nio.file.WatchEvent<?> event)
protected void register(java.nio.file.Path dir) throws java.io.IOException
java.io.IOException
protected void registerAll(java.nio.file.Path start) throws java.io.IOException
java.io.IOException
protected void processEvents()
static void usage()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException