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 file
    DateFileWatchdog​(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 changes
    void setChanged()  
    void stopIt()
    Stop monitoring this file for changes

    Methods inherited from class java.util.Observable

    addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DateFileWatchdog

      public DateFileWatchdog​(java.lang.String fileName, long howOften) throws java.lang.Exception
      Create a watcher for a given file name
      Parameters:
      fileName - path to the file to monitor
      howOften - 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.Exception
      Create 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 class java.lang.Object
      Throws:
      java.lang.Throwable
    • setChanged

      public void setChanged()
      Overrides:
      setChanged in class java.util.Observable