- java.lang.Object
-
- ilusr.core.io.DirectoryWatcher
-
public class DirectoryWatcher extends Object
- Author:
- Jeff Riggle
-
-
Constructor Summary
Constructors Constructor Description DirectoryWatcher(String dir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
startWatching(IDirectoryListener listener)
Starts watching for directory updates an notifies any registered @see IDirectoryListeners when changes occur.void
stopWatching(IDirectoryListener listener)
Stops a @see core.io.IDirectoryListener from geting updates about this directory.String
watchedDirectory()
-
-
-
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.
-
-