public interface DirectoryWatchService extends Service
Modifier and Type | Method and Description |
---|---|
void |
register(OnFileChangeListener listener,
String dirPath,
String... globPatterns)
Notifies the implementation of this interface that
dirPath should be monitored for file system events. |
void |
start()
Starts the service.
|
void |
unregister(OnFileChangeListener listener)
Notifies the implementation of this interface that
listener should cease to be notified of file system events. |
void |
unregisterAll()
Unregisters all listeners.
|
void start()
Service
void register(OnFileChangeListener listener, String dirPath, String... globPatterns) throws IOException
dirPath
should be monitored for file system events. If the
changed file matches any of the globPatterns
, listener
should be notified.listener
- The listener.dirPath
- The directory path.globPatterns
- Zero or more file patterns to be matched against
file names. If none provided, matches any
file.IOException
- If dirPath
is not a directory.void unregister(OnFileChangeListener listener)
listener
should cease to be notified of file system events.listener
- Listener to unregister. Cannot be null
.void unregisterAll()