public class DirectoryWatcher
extends java.lang.Thread
Modifier and Type | Class and Description |
---|---|
static interface |
DirectoryWatcher.FileChangeListener
Interface for FileChangeListeners
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SVN_DIR_NAME |
Constructor and Description |
---|
DirectoryWatcher() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(DirectoryWatcher.FileChangeListener listener)
Adds a file listener that can react to change events
|
void |
addWatchDirectory(java.io.File dir,
java.util.List<java.lang.String> fileExtensions)
Adds a directory to watch for the given file and extensions.
|
void |
addWatchDirectory(java.io.File dir,
java.lang.String extension)
Adds a directory to watch for the given file and extensions.
|
void |
addWatchFile(java.io.File fileToWatch)
Adds a file to the watch list
|
void |
run() |
void |
setActive(boolean active)
Sets whether to stop the directory watcher
|
void |
setSleepTime(long sleepTime)
Sets the amount of time to sleep between checks
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final java.lang.String SVN_DIR_NAME
public void setActive(boolean active)
active
- False if you want to stop watchingpublic void setSleepTime(long sleepTime)
sleepTime
- The sleep timepublic void addListener(DirectoryWatcher.FileChangeListener listener)
listener
- The file listenerpublic void addWatchFile(java.io.File fileToWatch)
fileToWatch
- The file to watchpublic void addWatchDirectory(java.io.File dir, java.util.List<java.lang.String> fileExtensions)
dir
- The directoryfileExtensions
- The extensionspublic void addWatchDirectory(java.io.File dir, java.lang.String extension)
dir
- The directoryextension
- The extensionpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread