Module ilusr.core
Package ilusr.core.io

Class DirectoryWatcher


  • public class DirectoryWatcher
    extends Object
    Author:
    Jeff Riggle
    • Constructor Detail

      • DirectoryWatcher

        public DirectoryWatcher​(String dir)
                         throws IOException
        Parameters:
        dir - The directory to watch.
        Throws:
        IOException
    • Method Detail

      • startWatching

        public void startWatching​(IDirectoryListener listener)
                           throws IOException
        Starts watching for directory updates an notifies any registered @see IDirectoryListeners when changes occur.
        Parameters:
        listener - The @see core.io.IDirectoryListener to be updated when directory modification occur.
        Throws:
        IOException
      • watchedDirectory

        public String watchedDirectory()
        Returns:
        The directory this watcher is watching.
      • stopWatching

        public void stopWatching​(IDirectoryListener listener)
        Stops a @see core.io.IDirectoryListener from geting updates about this directory.

        Note: Once all @see core.io.IDirectoryListeners are not watching this the directory watch is torn down.

        Parameters:
        listener - A @see core.io.IDirectoryListener to no longer get updates.