| java.lang.Object com.anthonyeden.lib.util.VFSFileMonitor
VFSFileMonitor | public class VFSFileMonitor implements Runnable(Code) | | Class which monitors a file in a thread separate from the main application.
If the file changes then the reload() method of the given target will be
executed.
author: Anthony Eden |
Field Summary | |
final public static int | DEFAULT_DELAY The default delay value (5 seconds) for checking for modifications. |
Constructor Summary | |
public | VFSFileMonitor(FileObject file, Reloadable target) Construct a new VFSFileMonitor for the given file and target. | public | VFSFileMonitor(FileObject file, long delay, Reloadable target) Construct a new VFSFileMonitor for the given file and target. |
Method Summary | |
public long | getDelay() Get the delay between file checks. | public FileObject | getFile() Get the file which is being monitored. | public void | run() The thread's run method. | public void | setDelay(long delay) Set the delay between checks. | public void | startMonitor() Start the monitoring thread. | public void | stopMonitor() Stop the monitoring thread. |
DEFAULT_DELAY | final public static int DEFAULT_DELAY(Code) | | The default delay value (5 seconds) for checking for modifications.
|
VFSFileMonitor | public VFSFileMonitor(FileObject file, Reloadable target) throws FileSystemException(Code) | | Construct a new VFSFileMonitor for the given file and target. The
default delay time will be used.
Parameters: file - The file to monitor Parameters: target - The target throws: FileSystemException - |
VFSFileMonitor | public VFSFileMonitor(FileObject file, long delay, Reloadable target) throws FileSystemException(Code) | | Construct a new VFSFileMonitor for the given file and target. The given
delay time will be used.
Parameters: file - The file to monitor Parameters: delay - The delay time Parameters: target - The target throws: FileSystemException - |
getDelay | public long getDelay()(Code) | | Get the delay between file checks.
The delay in milliseconds |
getFile | public FileObject getFile()(Code) | | Get the file which is being monitored.
The monitored file |
run | public void run()(Code) | | The thread's run method. This method should not be executed directly
nor should a thread be manually created, rather the startMonitor()
and stopMonitor() methods should be used to start and stop
the monitor.
|
setDelay | public void setDelay(long delay)(Code) | | Set the delay between checks. If the thread is already sleeping then
this delay will take effect during the next sleep.
Parameters: delay - The delay in milliseconds |
startMonitor | public void startMonitor()(Code) | | Start the monitoring thread. If the thread is already running then
this method will not attempt to start a new thread.
|
stopMonitor | public void stopMonitor()(Code) | | Stop the monitoring thread. If the monitoring thread is not running
then this method will do nothing.
|
|
|