|
|||||||||
| Home >> All >> org >> dinopolis >> util >> [ io overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dinopolis.util.io
Class FileChangeDetection

java.lang.Objectjava.lang.Thread
org.dinopolis.util.io.FileChangeDetection
- All Implemented Interfaces:
- java.lang.Runnable
- public class FileChangeDetection
- extends java.lang.Thread
This class checks a given file and detects any modifications (if the modificaiton time changes) and informs any listeners on this change.
- Version:
- $Revision: 1.1 $
| Nested Class Summary |
| Nested classes inherited from class java.lang.Thread |
java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
protected static long |
DEFAULT_LOOKUP_PERIOD
|
protected java.lang.String |
filename_
|
protected long |
last_modified_
|
protected java.util.Vector |
listeners_
|
protected long |
lookup_period_
|
protected boolean |
loop_thread_
|
protected java.io.File |
observed_file_
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
FileChangeDetection()
Constructor using the default lookup period. |
|
FileChangeDetection(java.lang.String filename)
Constructor observing the given file and using the default lookup period. |
|
FileChangeDetection(java.lang.String filename,
long lookup_period)
Constructor observing the given file and the given lookup period. |
|
| Method Summary | |
void |
addFileChangeListener(FileChangeListener listener)
Adds a listener that is informed about changes of the observed file. |
protected void |
fireChangeDetected()
Informs all registered listeners about a change. |
void |
remoteFileChangeListener(FileChangeListener listener)
Removes a listener that is informed about changes of the observed file. |
void |
run()
Checks the file for its modification time and informs the listeners on a change. |
void |
setFile(java.io.File file)
Set the file to check for changes. |
void |
setFile(java.lang.String filename)
Set the file to check for changes. |
void |
setLookupPeriod(long lookup_period)
Set the period to check the file for changes. |
void |
startChangeDetection()
Starts the thread that detects any modifications of the file. |
void |
stopChangeDetection()
Stops the thread that detects any modifications of the file. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, 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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
DEFAULT_LOOKUP_PERIOD
protected static final long DEFAULT_LOOKUP_PERIOD
- See Also:
- Constant Field Values
filename_
protected java.lang.String filename_
lookup_period_
protected long lookup_period_
loop_thread_
protected boolean loop_thread_
last_modified_
protected long last_modified_
observed_file_
protected java.io.File observed_file_
listeners_
protected java.util.Vector listeners_
| Constructor Detail |
FileChangeDetection
public FileChangeDetection()
- Constructor using the default lookup period.
FileChangeDetection
public FileChangeDetection(java.lang.String filename)
- Constructor observing the given file and using the default lookup period.
FileChangeDetection
public FileChangeDetection(java.lang.String filename, long lookup_period)
- Constructor observing the given file and the given lookup period.
| Method Detail |
setFile
public void setFile(java.lang.String filename)
- Set the file to check for changes.
setFile
public void setFile(java.io.File file)
- Set the file to check for changes.
setLookupPeriod
public void setLookupPeriod(long lookup_period)
- Set the period to check the file for changes.
startChangeDetection
public void startChangeDetection()
- Starts the thread that detects any modifications of the file.
stopChangeDetection
public void stopChangeDetection()
- Stops the thread that detects any modifications of the file.
addFileChangeListener
public void addFileChangeListener(FileChangeListener listener)
- Adds a listener that is informed about changes of the observed file.
remoteFileChangeListener
public void remoteFileChangeListener(FileChangeListener listener)
- Removes a listener that is informed about changes of the observed file.
fireChangeDetected
protected void fireChangeDetected()
- Informs all registered listeners about a change.
run
public void run()
- Checks the file for its modification time and informs the listeners
on a change. Then waits the amount of time set.
|
|||||||||
| Home >> All >> org >> dinopolis >> util >> [ io overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC