public class FileSystemWatcher extends Object
FileChangeListener
Constructor and Description |
---|
FileSystemWatcher()
Create a new
FileSystemWatcher instance. |
FileSystemWatcher(boolean daemon,
Duration pollInterval,
Duration quietPeriod)
Create a new
FileSystemWatcher instance. |
FileSystemWatcher(boolean daemon,
Duration pollInterval,
Duration quietPeriod,
SnapshotStateRepository snapshotStateRepository)
Create a new
FileSystemWatcher instance. |
Modifier and Type | Method and Description |
---|---|
void |
addListener(FileChangeListener fileChangeListener)
Add listener for file change events.
|
void |
addSourceDirectories(Iterable<File> directories)
Add source directories to monitor.
|
void |
addSourceDirectory(File directory)
Add a source directory to monitor.
|
void |
setTriggerFilter(FileFilter triggerFilter)
Set an optional
FileFilter used to limit the files that trigger a change. |
void |
start()
Start monitoring the source directory for changes.
|
void |
stop()
Stop monitoring the source directories.
|
public FileSystemWatcher()
FileSystemWatcher
instance.public FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod)
FileSystemWatcher
instance.daemon
- if a daemon thread used to monitor changespollInterval
- the amount of time to wait between checking for changesquietPeriod
- the amount of time required after a change has been detected to
ensure that updates have completedpublic FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository)
FileSystemWatcher
instance.daemon
- if a daemon thread used to monitor changespollInterval
- the amount of time to wait between checking for changesquietPeriod
- the amount of time required after a change has been detected to
ensure that updates have completedsnapshotStateRepository
- the snapshot state repositorypublic void addListener(FileChangeListener fileChangeListener)
started
.fileChangeListener
- the listener to addpublic void addSourceDirectories(Iterable<File> directories)
started
.directories
- the directories to monitorpublic void addSourceDirectory(File directory)
started
.directory
- the directory to monitorpublic void setTriggerFilter(FileFilter triggerFilter)
FileFilter
used to limit the files that trigger a change.triggerFilter
- a trigger filter or nullpublic void start()
public void stop()