public class FileMonitor extends Object
FileMonitorManager.createFileMonitor(IFileMonitorCallback) to use
this class effectively. All files that have the same callback (
IFileMonitorCallback) can be encapsulated in the same
FileMonitor.| Constructor and Description |
|---|
FileMonitor(IFileMonitorCallback aListener) |
| Modifier and Type | Method and Description |
|---|---|
EChange |
addMonitoredFile(File aFile)
Adds a file to be monitored.
|
protected void |
applyPendingAdds() |
protected void |
applyPendingDeletes() |
protected ICommonsCollection<com.helger.commons.io.monitor.FileMonitorAgent> |
getAllAgents() |
IFileMonitorCallback |
getListener() |
protected int |
getMonitoredFileCount() |
boolean |
isRecursive()
Access method to get the recursive setting when adding files for
monitoring.
|
protected void |
onFileChanged(File aFile)
Called on modification by
FileMonitorAgent. |
protected void |
onFileCreated(File aFile)
Called upon file creation by
FileMonitorAgent. |
protected void |
onFileDeleted(File aFile)
Called upon file deletion by
FileMonitorAgent. |
EChange |
removeMonitoredFile(File aFile)
Removes a file from being monitored.
|
FileMonitor |
setRecursive(boolean bRecursive)
Access method to set the recursive setting when adding files for
monitoring.
|
String |
toString() |
public FileMonitor(@Nonnull IFileMonitorCallback aListener)
@Nonnull public IFileMonitorCallback getListener()
null.public boolean isRecursive()
true if monitoring is enabled for children.@Nonnull public FileMonitor setRecursive(boolean bRecursive)
bRecursive - true if monitoring should be enabled for children,
false otherwise.@Nonnegative protected int getMonitoredFileCount()
@Nonnull public EChange addMonitoredFile(@Nonnull File aFile)
aFile - The File to monitor.EChange@Nonnull public EChange removeMonitoredFile(@Nonnull File aFile)
aFile - The File to remove from monitoring.EChangeprotected void onFileCreated(@Nonnull File aFile)
FileMonitorAgent.aFile - The File to add. Never null.protected void onFileDeleted(@Nonnull File aFile)
FileMonitorAgent.aFile - The File to be removed from being monitored. Never null
.protected void onFileChanged(@Nonnull File aFile)
FileMonitorAgent.aFile - The File that was modified. Never null.@Nonnull @ReturnsMutableCopy protected ICommonsCollection<com.helger.commons.io.monitor.FileMonitorAgent> getAllAgents()
protected void applyPendingDeletes()
protected void applyPendingAdds()
Copyright © 2014–2017 Philip Helger. All rights reserved.