Package org.apache.commons.vfs.provider
Class DelegateFileObject
- java.lang.Object
-
- org.apache.commons.vfs.provider.AbstractFileObject
-
- org.apache.commons.vfs.provider.DelegateFileObject
-
- All Implemented Interfaces:
FileListener,FileObject
public class DelegateFileObject extends AbstractFileObject implements FileListener
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
Constructors Constructor Description DelegateFileObject(FileName name, AbstractFileSystem fileSystem, FileObject file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachChild(FileName baseName, FileType type)Adds a child to this file.voidclose()Close the delegated fileprotected voiddoCreateFolder()Creates this file as a folder.protected voiddoDelete()Deletes the file.protected java.util.MapdoGetAttributes()Returns the attributes of this file.protected java.security.cert.Certificate[]doGetCertificates()Returns the certificates of this file.protected longdoGetContentSize()Returns the size of the file content (in bytes).protected java.io.InputStreamdoGetInputStream()Creates an input stream to read the file content from.protected longdoGetLastModifiedTime()Returns the last-modified time of this file.protected java.io.OutputStreamdoGetOutputStream(boolean bAppend)Creates an output stream to write the file content to.protected FileTypedoGetType()Determines the type of the file, returns null if the file does not exist.protected booleandoIsHidden()Determines if this file is hidden.protected booleandoIsReadable()Determines if this file can be read.protected booleandoIsWriteable()Determines if this file can be written to.protected java.lang.String[]doListChildren()Lists the children of the file.protected voiddoSetAttribute(java.lang.String atttrName, java.lang.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 org.apache.commons.vfs.provider.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 Detail
-
DelegateFileObject
public DelegateFileObject(FileName name, AbstractFileSystem fileSystem, FileObject file) throws FileSystemException
- Throws:
FileSystemException
-
-
Method Detail
-
attachChild
public void attachChild(FileName baseName, FileType type) throws java.lang.Exception
Adds a child to this file.- Throws:
java.lang.Exception
-
setFile
public void setFile(FileObject file) throws java.lang.Exception
Attaches or detaches the target file.- Throws:
java.lang.Exception
-
doGetType
protected FileType doGetType() throws FileSystemException
Determines the type of the file, returns null if the file does not exist.- Specified by:
doGetTypein classAbstractFileObject- Throws:
FileSystemException
-
doIsReadable
protected boolean doIsReadable() throws FileSystemExceptionDetermines if this file can be read.- Overrides:
doIsReadablein classAbstractFileObject- Throws:
FileSystemException
-
doIsWriteable
protected boolean doIsWriteable() throws FileSystemExceptionDetermines if this file can be written to.- Overrides:
doIsWriteablein classAbstractFileObject- Throws:
FileSystemException
-
doIsHidden
protected boolean doIsHidden() throws FileSystemExceptionDetermines if this file is hidden.- Overrides:
doIsHiddenin classAbstractFileObject- Throws:
FileSystemException
-
doListChildren
protected java.lang.String[] doListChildren() throws java.lang.ExceptionLists the children of the file.- Specified by:
doListChildrenin classAbstractFileObject- Throws:
java.lang.Exception
-
doCreateFolder
protected void doCreateFolder() throws java.lang.ExceptionCreates this file as a folder.- Overrides:
doCreateFolderin classAbstractFileObject- Throws:
java.lang.Exception
-
doDelete
protected void doDelete() throws java.lang.ExceptionDeletes the file.- Overrides:
doDeletein classAbstractFileObject- Throws:
java.lang.Exception
-
doGetContentSize
protected long doGetContentSize() throws java.lang.ExceptionReturns the size of the file content (in bytes). Is only called ifdoGetType()returnsFileType.FILE.- Specified by:
doGetContentSizein classAbstractFileObject- Throws:
java.lang.Exception
-
doGetAttributes
protected java.util.Map doGetAttributes() throws java.lang.ExceptionReturns the attributes of this file.- Overrides:
doGetAttributesin classAbstractFileObject- Throws:
java.lang.Exception
-
doSetAttribute
protected void doSetAttribute(java.lang.String atttrName, java.lang.Object value) throws java.lang.ExceptionSets an attribute of this file.- Overrides:
doSetAttributein classAbstractFileObject- Throws:
java.lang.Exception
-
doGetCertificates
protected java.security.cert.Certificate[] doGetCertificates() throws java.lang.ExceptionReturns the certificates of this file.- Overrides:
doGetCertificatesin classAbstractFileObject- Throws:
java.lang.Exception
-
doGetLastModifiedTime
protected long doGetLastModifiedTime() throws java.lang.ExceptionReturns the last-modified time of this file.- Overrides:
doGetLastModifiedTimein classAbstractFileObject- Throws:
java.lang.Exception
-
doSetLastModifiedTime
protected void doSetLastModifiedTime(long modtime) throws java.lang.ExceptionSets the last-modified time of this file.- Overrides:
doSetLastModifiedTimein classAbstractFileObject- Throws:
java.lang.Exception
-
doGetInputStream
protected java.io.InputStream doGetInputStream() throws java.lang.ExceptionCreates an input stream to read the file content from.- Specified by:
doGetInputStreamin classAbstractFileObject- Throws:
java.lang.Exception
-
doGetOutputStream
protected java.io.OutputStream doGetOutputStream(boolean bAppend) throws java.lang.ExceptionCreates an output stream to write the file content to.- Overrides:
doGetOutputStreamin classAbstractFileObject- Throws:
java.lang.Exception
-
fileCreated
public void fileCreated(FileChangeEvent event) throws java.lang.Exception
Called when a file is created.- Specified by:
fileCreatedin interfaceFileListener- Throws:
java.lang.Exception
-
fileDeleted
public void fileDeleted(FileChangeEvent event) throws java.lang.Exception
Called when a file is deleted.- Specified by:
fileDeletedin interfaceFileListener- Throws:
java.lang.Exception
-
fileChanged
public void fileChanged(FileChangeEvent event) throws java.lang.Exception
Called when a file is changed. This will only happen if you monitor the file usingFileMonitor.- Specified by:
fileChangedin interfaceFileListener- Throws:
java.lang.Exception
-
close
public void close() throws FileSystemExceptionClose the delegated file- Specified by:
closein interfaceFileObject- Overrides:
closein classAbstractFileObject- Throws:
FileSystemException- On error closing the file.- See Also:
FileContent.close()
-
-