|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.io.FileMonitor
public class FileMonitor
Monitoring disk files changes. Change event is broadcasted to all registered listeners.
FileChangeListener
Nested Class Summary | |
---|---|
protected class |
FileMonitor.FileMonitorNotifier
Actual file monitor timer task. |
Field Summary | |
---|---|
protected java.util.Map<java.io.File,java.lang.Long> |
files
|
protected java.util.Set<FileChangeListener> |
listeners
|
protected java.lang.Object |
lock
|
protected long |
pollingInterval
|
protected java.util.Timer |
timer
|
Constructor Summary | |
---|---|
FileMonitor(long pollingInterval)
Creates a file monitor instance with specified polling interval in ms. |
Method Summary | |
---|---|
void |
monitorFile(java.io.File file)
Adds file to listen for. |
void |
registerListener(FileChangeListener fileChangeListener)
Adds listener to this file monitor. |
void |
releaseFile(java.io.File file)
Removes specified file for listening. |
void |
removeAllListeners()
Removes all file listeners/ |
void |
removeListener(FileChangeListener fileChangeListener)
Removes listener from this file monitor. |
void |
start()
Starts the file monitoring polling, after it was stopped. |
void |
stop()
Stops the file monitor polling. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<java.io.File,java.lang.Long> files
protected final java.util.Set<FileChangeListener> listeners
protected final long pollingInterval
protected java.util.Timer timer
protected final java.lang.Object lock
Constructor Detail |
---|
public FileMonitor(long pollingInterval)
Method Detail |
---|
public void start()
public void stop()
public void monitorFile(java.io.File file)
public void releaseFile(java.io.File file)
public void registerListener(FileChangeListener fileChangeListener)
public void removeListener(FileChangeListener fileChangeListener)
public void removeAllListeners()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |