? FileAlterationMonitor
java.lang.Object
org.apache.commons.io.monitor.FileAlterationMonitor
- ????????:
Runnable
A runnable that spawns a monitoring thread triggering any
registered
FileAlterationObserver
at a specified interval.- ???????:
- 2.0
- ????:
-
?????
????????Constructs a monitor with a default interval of 10 seconds.FileAlterationMonitor
(long interval) Constructs a monitor with the specified interval.FileAlterationMonitor
(long interval, Collection<FileAlterationObserver> observers) Constructs a monitor with the specified interval and collection of observers.FileAlterationMonitor
(long interval, FileAlterationObserver... observers) Constructs a monitor with the specified interval and set of observers. -
????
??????????void
addObserver
(FileAlterationObserver observer) Adds a file system observer to this monitor.long
Returns the interval.Returns the set ofFileAlterationObserver
registered with this monitor.void
removeObserver
(FileAlterationObserver observer) Removes a file system observer from this monitor.void
run()
Runs this monitor.void
setThreadFactory
(ThreadFactory threadFactory) Sets the thread factory.void
start()
Starts monitoring.void
stop()
Stops monitoring.void
stop
(long stopInterval) Stops monitoring.
-
???????
-
FileAlterationMonitor
public FileAlterationMonitor()Constructs a monitor with a default interval of 10 seconds. -
FileAlterationMonitor
Constructs a monitor with the specified interval.- ??:
interval
- The amount of time in milliseconds to wait between checks of the file system.
-
FileAlterationMonitor
Constructs a monitor with the specified interval and collection of observers.- ??:
interval
- The amount of time in milliseconds to wait between checks of the file system.observers
- The collection of observers to add to the monitor.- ???????:
- 2.9.0
-
FileAlterationMonitor
Constructs a monitor with the specified interval and set of observers.- ??:
interval
- The amount of time in milliseconds to wait between checks of the file system.observers
- The set of observers to add to the monitor.
-
-
??????
-
getInterval
Returns the interval.- ??:
- the interval
-
setThreadFactory
Sets the thread factory.- ??:
threadFactory
- the thread factory
-
addObserver
Adds a file system observer to this monitor.- ??:
observer
- The file system observer to add
-
removeObserver
Removes a file system observer from this monitor.- ??:
observer
- The file system observer to remove
-
getObservers
Returns the set ofFileAlterationObserver
registered with this monitor.- ??:
- The set of
FileAlterationObserver
-
start
Starts monitoring.- ??:
Exception
- if an error occurs initializing the observer
-
stop
Stops monitoring.- ??:
Exception
- if an error occurs initializing the observer
-
stop
Stops monitoring.- ??:
stopInterval
- the amount of time in milliseconds to wait for the thread to finish. A value of zero will wait until the thread is finished (seeThread.join(long)
).- ??:
Exception
- if an error occurs initializing the observer- ???????:
- 2.1
-
run
Runs this monitor.
-