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. |
Modifier and Type | Method and Description |
---|---|
void |
addListener(FileChangeListener fileChangeListener)
Add listener for file change events.
|
void |
addSourceFolder(File folder)
Add a source folder to monitor.
|
void |
addSourceFolders(Iterable<File> folders)
Add source folders 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 folder for changes.
|
void |
stop()
Stop monitoring the source folders.
|
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 void addListener(FileChangeListener fileChangeListener)
started
.fileChangeListener
- the listener to addpublic void addSourceFolders(Iterable<File> folders)
started
.folders
- the folders to monitorpublic void addSourceFolder(File folder)
started
.folder
- the folder 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()
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.