Class WeakRefFileListener
java.lang.Object
org.apache.commons.vfs2.util.WeakRefFileListener
- All Implemented Interfaces:
FileListener
Wraps a listener with a WeakReference.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileSystemprivate final WeakReference<FileListener> private final FileName -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWeakRefFileListener(FileObject file, FileListener listener) -
Method Summary
Modifier and TypeMethodDescriptionvoidfileChanged(FileChangeEvent event) Called when a file is changed.voidfileCreated(FileChangeEvent event) Called when a file is created.voidfileDeleted(FileChangeEvent event) Called when a file is deleted.protected FileListenerGets the wrapped listener.static voidinstallListener(FileObject file, FileListener listener) Installs thelistenerat the givenfile.
-
Field Details
-
fs
-
name
-
listener
-
-
Constructor Details
-
WeakRefFileListener
-
-
Method Details
-
installListener
Installs thelistenerat the givenfile.- Parameters:
file- The FileObject to listen on.listener- The FileListener
-
getListener
Gets the wrapped listener. If it is gone, the WeakRefFileListener wrapper will remove itself from the list of listeners.- Returns:
- The FileListener.
- Throws:
Exception- if an error occurs.
-
fileCreated
Called when a file is created.- Specified by:
fileCreatedin interfaceFileListener- Parameters:
event- The FileChangeEvent.- Throws:
Exception- if an error occurs.
-
fileDeleted
Called when a file is deleted.- Specified by:
fileDeletedin interfaceFileListener- Parameters:
event- The FileChangeEvent.- Throws:
Exception- if an error occurs.
-
fileChanged
Called when a file is changed.This will only happen if you monitor the file using
FileMonitor.- Specified by:
fileChangedin interfaceFileListener- Parameters:
event- The FileChangeEvent.- Throws:
Exception- if an error occurs.
-