类 FileSystemWatcher
java.lang.Object
org.springframework.boot.devtools.filewatch.FileSystemWatcher
Watches specific directories for file changes.
- 从以下版本开始:
- 1.3.0
- 作者:
- Andy Clement, Phillip Webb
- 另请参阅:
-
构造器概要
构造器构造器说明Create a newFileSystemWatcher
instance.FileSystemWatcher
(boolean daemon, Duration pollInterval, Duration quietPeriod) Create a newFileSystemWatcher
instance.FileSystemWatcher
(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository) Create a newFileSystemWatcher
instance. -
方法概要
修饰符和类型方法说明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 optionalFileFilter
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.
-
构造器详细资料
-
FileSystemWatcher
public FileSystemWatcher()Create a newFileSystemWatcher
instance. -
FileSystemWatcher
Create a newFileSystemWatcher
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 completed
-
FileSystemWatcher
public FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod, SnapshotStateRepository snapshotStateRepository) Create a newFileSystemWatcher
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 repository- 从以下版本开始:
- 2.4.0
-
-
方法详细资料
-
addListener
Add listener for file change events. Cannot be called after the watcher has beenstarted
.- 参数:
fileChangeListener
- the listener to add
-
addSourceDirectories
Add source directories to monitor. Cannot be called after the watcher has beenstarted
.- 参数:
directories
- the directories to monitor
-
addSourceDirectory
Add a source directory to monitor. Cannot be called after the watcher has beenstarted
.- 参数:
directory
- the directory to monitor
-
setTriggerFilter
Set an optionalFileFilter
used to limit the files that trigger a change.- 参数:
triggerFilter
- a trigger filter or null
-
start
public void start()Start monitoring the source directory for changes. -
stop
public void stop()Stop monitoring the source directories.
-