public class FileMonitor
extends java.lang.Object
FileChangeListener| Modifier and Type | Class and Description |
|---|---|
protected class |
FileMonitor.FileMonitorNotifier
Actual file monitor timer task.
|
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
FileMonitor(long pollingInterval)
Creates a file monitor instance with specified polling interval in ms.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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
public FileMonitor(long pollingInterval)
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()
Copyright © 2003-2013 Jodd Team