Class DelegateFileObject
java.lang.Object
org.apache.commons.vfs.provider.AbstractFileObject
org.apache.commons.vfs.provider.DelegateFileObject
- All Implemented Interfaces:
FileListener, FileObject
A file backed by another file.
- Version:
- $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov 2006) $
- Author:
- Adam Murdoch, Gary D. Gregory
-
Constructor Summary
ConstructorsConstructorDescriptionDelegateFileObject(FileName name, AbstractFileSystem fileSystem, FileObject file) -
Method Summary
Modifier and TypeMethodDescriptionvoidattachChild(FileName baseName, FileType type) Adds a child to this file.voidclose()Close the delegated fileprotected voidCreates this file as a folder.protected voiddoDelete()Deletes the file.protected MapReturns the attributes of this file.protected Certificate[]Returns the certificates of this file.protected longReturns the size of the file content (in bytes).protected InputStreamCreates an input stream to read the file content from.protected longReturns the last-modified time of this file.protected OutputStreamdoGetOutputStream(boolean bAppend) Creates an output stream to write the file content to.protected FileTypeDetermines the type of the file, returns null if the file does not exist.protected booleanDetermines if this file is hidden.protected booleanDetermines if this file can be read.protected booleanDetermines if this file can be written to.protected String[]Lists the children of the file.protected voiddoSetAttribute(String atttrName, Object value) Sets an attribute of this file.protected voiddoSetLastModifiedTime(long modtime) Sets the last-modified time of this file.voidfileChanged(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.voidsetFile(FileObject file) Attaches or detaches the target file.Methods inherited from class AbstractFileObject
canRenameTo, childrenChanged, childrenChanged, copyFrom, createFile, createFolder, delete, delete, doAttach, doDetach, doGetRandomAccessContent, doIsSameFile, doListChildrenResolved, doRename, endOutput, exists, finalize, findFiles, findFiles, getChild, getChildren, getContent, getFileContentInfoFactory, getFileOperations, getFileSystem, getInputStream, getName, getOutputStream, getOutputStream, getParent, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isHidden, isReadable, isSameFile, isWriteable, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, toString
-
Constructor Details
-
DelegateFileObject
public DelegateFileObject(FileName name, AbstractFileSystem fileSystem, FileObject file) throws FileSystemException - Throws:
FileSystemException
-
-
Method Details
-
attachChild
-
setFile
Attaches or detaches the target file.- Throws:
Exception
-
doGetType
Determines the type of the file, returns null if the file does not exist.- Specified by:
doGetTypein classAbstractFileObject- Throws:
FileSystemException
-
doIsReadable
Determines if this file can be read.- Overrides:
doIsReadablein classAbstractFileObject- Throws:
FileSystemException
-
doIsWriteable
Determines if this file can be written to.- Overrides:
doIsWriteablein classAbstractFileObject- Throws:
FileSystemException
-
doIsHidden
Determines if this file is hidden.- Overrides:
doIsHiddenin classAbstractFileObject- Throws:
FileSystemException
-
doListChildren
Lists the children of the file.- Specified by:
doListChildrenin classAbstractFileObject- Throws:
Exception
-
doCreateFolder
Creates this file as a folder.- Overrides:
doCreateFolderin classAbstractFileObject- Throws:
Exception
-
doDelete
Deletes the file.- Overrides:
doDeletein classAbstractFileObject- Throws:
Exception
-
doGetContentSize
Returns the size of the file content (in bytes). Is only called ifdoGetType()returnsFileType.FILE.- Specified by:
doGetContentSizein classAbstractFileObject- Throws:
Exception
-
doGetAttributes
Returns the attributes of this file.- Overrides:
doGetAttributesin classAbstractFileObject- Throws:
Exception
-
doSetAttribute
Sets an attribute of this file.- Overrides:
doSetAttributein classAbstractFileObject- Throws:
Exception
-
doGetCertificates
Returns the certificates of this file.- Overrides:
doGetCertificatesin classAbstractFileObject- Throws:
Exception
-
doGetLastModifiedTime
Returns the last-modified time of this file.- Overrides:
doGetLastModifiedTimein classAbstractFileObject- Throws:
Exception
-
doSetLastModifiedTime
Sets the last-modified time of this file.- Overrides:
doSetLastModifiedTimein classAbstractFileObject- Throws:
Exception
-
doGetInputStream
Creates an input stream to read the file content from.- Specified by:
doGetInputStreamin classAbstractFileObject- Throws:
Exception
-
doGetOutputStream
Creates an output stream to write the file content to.- Overrides:
doGetOutputStreamin classAbstractFileObject- Throws:
Exception
-
fileCreated
Called when a file is created.- Specified by:
fileCreatedin interfaceFileListener- Throws:
Exception
-
fileDeleted
Called when a file is deleted.- Specified by:
fileDeletedin interfaceFileListener- Throws:
Exception
-
fileChanged
Called when a file is changed. This will only happen if you monitor the file usingFileMonitor.- Specified by:
fileChangedin interfaceFileListener- Throws:
Exception
-
close
Close the delegated file- Specified by:
closein interfaceFileObject- Overrides:
closein classAbstractFileObject- Throws:
FileSystemException- On error closing the file.- See Also:
-