Package lazyj
Class DateFileWatchdog
java.lang.Object
java.util.Observable
lazyj.DateFileWatchdog
public final class DateFileWatchdog
extends java.util.Observable
This class monitors a specified File for a change and notifies back when the file on disk has changed. It is based on the last modification time of the file.
-
Constructor Summary
Constructors Constructor Description DateFileWatchdog(java.io.File f, long howOften)
Create a watcher for a given fileDateFileWatchdog(java.lang.String fileName, long howOften)
Create a watcher for a given file name -
Method Summary
Modifier and Type Method Description protected void
finalize()
java.io.File
getFile()
Get the file that is monitored for changesvoid
setChanged()
void
stopIt()
Stop monitoring this file for changes
-
Constructor Details
-
DateFileWatchdog
public DateFileWatchdog(java.lang.String fileName, long howOften) throws java.lang.ExceptionCreate a watcher for a given file name- Parameters:
fileName
- path to the file to monitorhowOften
- How often to verify for a change ( in millis )- Throws:
java.lang.Exception
-
DateFileWatchdog
public DateFileWatchdog(java.io.File f, long howOften) throws java.lang.ExceptionCreate a watcher for a given file- Parameters:
f
-howOften
- - How often to verify for a change ( in millis )- Throws:
java.lang.Exception
-
-
Method Details
-
getFile
public java.io.File getFile()Get the file that is monitored for changes- Returns:
- the file that is monitored for changes
-
stopIt
public void stopIt()Stop monitoring this file for changes -
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
setChanged
public void setChanged()- Overrides:
setChanged
in classjava.util.Observable
-