Package de.mhus.lib.core.io
Class FileWatch
- java.lang.Object
-
- java.util.TimerTask
-
- de.mhus.lib.core.MTimerTask
-
- de.mhus.lib.core.MHousekeeperTask
-
- de.mhus.lib.core.io.FileWatch
-
- All Implemented Interfaces:
de.mhus.lib.basics.Named,ITimerTask,Runnable
public class FileWatch extends MHousekeeperTask
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFileWatch.Listener
-
Field Summary
-
Fields inherited from class de.mhus.lib.core.MTimerTask
CANCELLED, environment, EXECUTED, SCHEDULED, UNKNOWN, VIRGIN
-
-
Constructor Summary
Constructors Constructor Description FileWatch(File fileToWatch, long period, boolean startHook, FileWatch.Listener listener)Watch a file or directory (one level!) against changes.FileWatch(File fileToWatch, FileWatch.Listener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckFile()protected voiddoit()FileWatchdoStart()FileWatchdoStop()FilegetFile()StringtoString()-
Methods inherited from class de.mhus.lib.core.MHousekeeperTask
log
-
Methods inherited from class de.mhus.lib.core.MTimerTask
cancel, getName, getStatus, isCanceled, onError, onFinal, run, run, setCanceled, setName
-
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
-
-
-
-
Constructor Detail
-
FileWatch
public FileWatch(File fileToWatch, FileWatch.Listener listener)
-
FileWatch
public FileWatch(File fileToWatch, long period, boolean startHook, FileWatch.Listener listener)
Watch a file or directory (one level!) against changes. Check the modify date to recognize a change. It has two ways to work: 1. Manual check, every time you use the file, call the checkFile() method. 2. Use of a timer.- Parameters:
fileToWatch-period-startHook-listener-
-
-