public class DirectoryWatchService extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<WatchKey,Path> |
keys |
protected Map<Path,DirectoryWatchEventListener> |
listeners |
protected WatchService |
watcher |
| Constructor and Description |
|---|
DirectoryWatchService()
Initialize the watching technology.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancelWatch(Object token)
Cancel a previously established watch
|
Object |
establishWatch(Path watch,
DirectoryWatchEventListener listener)
Register a watch on the specified directory/file
|
protected final WatchService watcher
protected final Map<Path,DirectoryWatchEventListener> listeners
public DirectoryWatchService()
throws IOException
IOExceptionpublic Object establishWatch(Path watch, DirectoryWatchEventListener listener) throws IOException
IOExceptionpublic boolean cancelWatch(Object token)
token - Value returned from establishWatchCopyright © 2015–2024 Frank Stock. All rights reserved.