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
IOException
public Object establishWatch(Path watch, DirectoryWatchEventListener listener) throws IOException
IOException
public boolean cancelWatch(Object token)
token
- Value returned from establishWatch
Copyright © 2015–2024 Frank Stock. All rights reserved.