info.rolandkrueger.roklib.files
Class FileModificationWatchdog

java.lang.Object
  extended by info.rolandkrueger.roklib.files.FileModificationWatchdog

public class FileModificationWatchdog
extends Object


Field Summary
private static long DEFAULT_WAIT_INTERVAL
           
private  int mDirectoryFileCount
           
private  long mDirectoryFileHash
           
private  List<DirectoryModificationListener> mDirectoryModificationListeners
           
private  File mFile
           
private  List<FileModificationListener> mFileModificationListeners
           
private  long mLastModified
           
private  Timer mTimer
           
private  long mWaitInterval
           
 
Constructor Summary
FileModificationWatchdog(File watchedFileOrDirectory)
           
FileModificationWatchdog(File watchedDirectory, DirectoryModificationListener listener)
           
FileModificationWatchdog(File watchedDirectory, DirectoryModificationListener listener, long waitInterval)
           
FileModificationWatchdog(File watchedFile, FileModificationListener listener)
           
FileModificationWatchdog(File watchedFile, FileModificationListener listener, long waitInterval)
           
FileModificationWatchdog(File watchedFileOrDirectory, long waitInterval)
           
 
Method Summary
 void addDirectoryModificationListener(DirectoryModificationListener listener)
           
 void addFileModificationListener(FileModificationListener listener)
           
private  void fireFileChanged()
           
private  void fireFileDeleted()
           
private  void fireFilesAdded()
           
private  void fireFilesRemoved()
           
private  int getDirectoryFileCount()
           
private  long getDirectoryFileHash()
           
private  void getDirectoryStatistics()
           
private  List<DirectoryModificationListener> getDirModListenerList()
           
private  List<FileModificationListener> getFileModListenerList()
           
 File getWatchedFile()
           
 boolean isWatchedFileDirectory()
           
 void removeDirectoryModificationListener(DirectoryModificationListener listener)
           
 void removeFileModificationListener(FileModificationListener listener)
           
 void setWaitInterval(long interval)
           
 void startWatching()
           
 void stopWatching()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WAIT_INTERVAL

private static final long DEFAULT_WAIT_INTERVAL
See Also:
Constant Field Values

mFile

private File mFile

mLastModified

private long mLastModified

mFileModificationListeners

private List<FileModificationListener> mFileModificationListeners

mDirectoryModificationListeners

private List<DirectoryModificationListener> mDirectoryModificationListeners

mWaitInterval

private long mWaitInterval

mTimer

private Timer mTimer

mDirectoryFileCount

private int mDirectoryFileCount

mDirectoryFileHash

private long mDirectoryFileHash
Constructor Detail

FileModificationWatchdog

public FileModificationWatchdog(File watchedFileOrDirectory,
                                long waitInterval)
                         throws FileNotFoundException
Throws:
FileNotFoundException

FileModificationWatchdog

public FileModificationWatchdog(File watchedFileOrDirectory)
                         throws FileNotFoundException
Throws:
FileNotFoundException

FileModificationWatchdog

public FileModificationWatchdog(File watchedDirectory,
                                DirectoryModificationListener listener,
                                long waitInterval)
                         throws FileNotFoundException
Throws:
FileNotFoundException

FileModificationWatchdog

public FileModificationWatchdog(File watchedDirectory,
                                DirectoryModificationListener listener)
                         throws FileNotFoundException
Throws:
FileNotFoundException

FileModificationWatchdog

public FileModificationWatchdog(File watchedFile,
                                FileModificationListener listener,
                                long waitInterval)
                         throws FileNotFoundException
Throws:
FileNotFoundException

FileModificationWatchdog

public FileModificationWatchdog(File watchedFile,
                                FileModificationListener listener)
                         throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

setWaitInterval

public void setWaitInterval(long interval)

startWatching

public void startWatching()

stopWatching

public void stopWatching()

getDirectoryStatistics

private void getDirectoryStatistics()

getDirectoryFileCount

private int getDirectoryFileCount()

getDirectoryFileHash

private long getDirectoryFileHash()

addFileModificationListener

public void addFileModificationListener(FileModificationListener listener)

addDirectoryModificationListener

public void addDirectoryModificationListener(DirectoryModificationListener listener)

removeFileModificationListener

public void removeFileModificationListener(FileModificationListener listener)

removeDirectoryModificationListener

public void removeDirectoryModificationListener(DirectoryModificationListener listener)

getDirModListenerList

private List<DirectoryModificationListener> getDirModListenerList()

getFileModListenerList

private List<FileModificationListener> getFileModListenerList()

isWatchedFileDirectory

public boolean isWatchedFileDirectory()

getWatchedFile

public File getWatchedFile()

fireFilesAdded

private void fireFilesAdded()

fireFilesRemoved

private void fireFilesRemoved()

fireFileDeleted

private void fireFileDeleted()

fireFileChanged

private void fireFileChanged()


Copyright © 2007-2011. All Rights Reserved.