public class DirectoryWatchService extends Object implements Runnable
T-Plan Robot Enterprise, (C) 2009-2025 T-Plan Limited. All rights reserved.
Modifier and Type | Method and Description |
---|---|
void |
run()
Process all events for keys queued to the watcher
|
static void |
setEnabled(File f,
PropertyChangeListener l,
boolean b)
Enable or disable watching of a directory for a single listener.
|
static void |
start(File dir,
PropertyChangeListener l)
Start watching a directory.
|
static void |
stop(File dir)
Stop watching a directory.
|
public static void start(File dir, PropertyChangeListener l) throws IOException
dir
- a directory.l
- a listener.IOException
- if the directory can't be watched for an I/O error.public static void stop(File dir)
Stop watching a directory. If the directory is not being watched the method does nothing.
This is a global action which affects all listeners registered to the
service for the given directory. To stop watching for a single listener
use the
setEnabled(java.io.File, java.beans.PropertyChangeListener, boolean)
method.
dir
- a directory to stop watching.public static void setEnabled(File f, PropertyChangeListener l, boolean b)
f
- a directory.l
- a listener.b
- true/false to enable/disable watching for the specified
listener.