Class DirectoryMonitor

  • All Implemented Interfaces:
    java.lang.Runnable

    public class DirectoryMonitor
    extends java.lang.Thread
    Class for monitor directory content changes. It just looks directory every x seconds and run callback if some files changed.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  DirectoryMonitor.Callback
      Callback for monitoring.
      static interface  DirectoryMonitor.DirectoryCallback  
      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkChanges()
      Process changes in directory.
      void fin()
      Stop directory monitoring.
      java.io.File getDir()  
      java.util.Set<java.io.File> getExistFiles()  
      void run()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getDir

        public java.io.File getDir()
      • fin

        public void fin()
        Stop directory monitoring.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • getExistFiles

        public java.util.Set<java.io.File> getExistFiles()
      • checkChanges

        public void checkChanges()
        Process changes in directory. This method can be called before thread start for load all files from directory immediately.