Package org.omegat.util
Class DirectoryMonitor
- java.lang.Object
-
- java.lang.Thread
-
- org.omegat.util.DirectoryMonitor
-
- All Implemented Interfaces:
java.lang.Runnable
public class DirectoryMonitor extends java.lang.Thread
Class for monitor directory content changes. It just looks directory every x seconds and run callback if some files changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DirectoryMonitor.Callback
Callback for monitoring.static interface
DirectoryMonitor.DirectoryCallback
-
Constructor Summary
Constructors Constructor Description DirectoryMonitor(java.io.File dir, DirectoryMonitor.Callback callback)
Create monitor.DirectoryMonitor(java.io.File dir, DirectoryMonitor.Callback callback, DirectoryMonitor.DirectoryCallback directoryCallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkChanges()
Process changes in directory.void
fin()
Stop directory monitoring.java.io.File
getDir()
java.util.Set<java.io.File>
getExistFiles()
void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
DirectoryMonitor
public DirectoryMonitor(java.io.File dir, DirectoryMonitor.Callback callback)
Create monitor.- Parameters:
dir
- directory to monitoring
-
DirectoryMonitor
public DirectoryMonitor(java.io.File dir, DirectoryMonitor.Callback callback, DirectoryMonitor.DirectoryCallback directoryCallback)
-
-
Method Detail
-
getDir
public java.io.File getDir()
-
fin
public void fin()
Stop directory monitoring.
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
getExistFiles
public java.util.Set<java.io.File> getExistFiles()
-
checkChanges
public void checkChanges()
Process changes in directory. This method can be called before thread start for load all files from directory immediately.
-
-