public final class FileMonitor extends Object
File
for changes and notifying all registered
IFileChangeListener
.Modifier and Type | Method and Description |
---|---|
void |
addFileChangeListener(IFileChangeListener listener,
File file,
long period)
Adds a monitored file with a FileChangeListener.
|
void |
addFileChangeListener(IFileChangeListener listener,
String fileName,
long period)
Adds a monitored file with a
IFileChangeListener . |
protected void |
fireFileChangeEvent(IFileChangeListener listener,
File file)
Fires notification that a file changed.
|
static FileMonitor |
getInstance()
Gets the file monitor instance.
|
void |
removeFileChangeListener(IFileChangeListener listener,
File file)
Remove the listener from the notification list.
|
void |
removeFileChangeListener(IFileChangeListener listener,
String fileName)
Remove the listener from the notification list.
|
public static FileMonitor getInstance()
public void addFileChangeListener(IFileChangeListener listener, String fileName, long period) throws FileNotFoundException
IFileChangeListener
.listener
- listener to notify when the file changed.fileName
- name of the file to monitor.period
- polling period in milliseconds.FileNotFoundException
- error with the filepublic void addFileChangeListener(IFileChangeListener listener, File file, long period) throws FileNotFoundException
listener
- listener to notify when the file changed.file
- the file to monitor.period
- polling period in milliseconds.FileNotFoundException
- error with the filepublic void removeFileChangeListener(IFileChangeListener listener, String fileName)
listener
- the listener to be removed.fileName
- name of the file for which to remove the listenerpublic void removeFileChangeListener(IFileChangeListener listener, File file)
listener
- the listener to be removed.file
- the file for which to remove the listenerprotected void fireFileChangeEvent(IFileChangeListener listener, File file)
listener
- file change listenerfile
- the file that changedCopyright © 2008–2021 Norconex Inc.. All rights reserved.