Class FtpFileObject
java.lang.Object
org.apache.commons.vfs.provider.AbstractFileObject
org.apache.commons.vfs.provider.ftp.FtpFileObject
- All Implemented Interfaces:
FileObject
An FTP file.
- Version:
- $Revision: 484943 $ $Date: 2006-12-09 08:42:06 +0100 (Sat, 09 Dec 2006) $
- Author:
- Adam Murdoch
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FtpFileObject
(FileName name, FtpFileSystem fileSystem, FileName rootName) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doAttach()
Attaches this file object to its file resource.protected void
Creates this file as a folder.protected void
doDelete()
Deletes the file.protected void
doDetach()
Detaches this file object from its file resource.protected long
Returns the size of the file content (in bytes).protected InputStream
Creates an input stream to read the file content from.protected long
get the last modified time on an ftp fileprotected OutputStream
doGetOutputStream
(boolean bAppend) Creates an output stream to write the file content to.protected RandomAccessContent
Creates access to the file for random i/o.protected FileType
Determines the type of the file, returns null if the file does not exist.protected String[]
Lists the children of the file.protected FileObject[]
Lists the children of this file.protected void
doRename
(FileObject newfile) Renames the fileprotected void
onChange()
Called when the type or content of this file changes.protected void
onChildrenChanged
(FileName child, FileType newType) Called when the children of this file change.void
refresh()
This will prepare the fileObject to get resynchronized with the underlaying filesystem if requiredMethods inherited from class org.apache.commons.vfs.provider.AbstractFileObject
canRenameTo, childrenChanged, childrenChanged, close, copyFrom, createFile, createFolder, delete, delete, doGetAttributes, doGetCertificates, doIsHidden, doIsReadable, doIsSameFile, doIsWriteable, doSetAttribute, doSetLastModifiedTime, 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, resolveFile, resolveFile, toString
-
Constructor Details
-
FtpFileObject
protected FtpFileObject(FileName name, FtpFileSystem fileSystem, FileName rootName) throws FileSystemException - Throws:
FileSystemException
-
-
Method Details
-
doAttach
Attaches this file object to its file resource.- Overrides:
doAttach
in classAbstractFileObject
- Throws:
IOException
-
refresh
Description copied from class:AbstractFileObject
This will prepare the fileObject to get resynchronized with the underlaying filesystem if required- Specified by:
refresh
in interfaceFileObject
- Overrides:
refresh
in classAbstractFileObject
- Throws:
FileSystemException
-
doDetach
protected void doDetach()Detaches this file object from its file resource.- Overrides:
doDetach
in classAbstractFileObject
-
onChildrenChanged
Called when the children of this file change.- Overrides:
onChildrenChanged
in classAbstractFileObject
-
onChange
Called when the type or content of this file changes.- Overrides:
onChange
in classAbstractFileObject
- Throws:
IOException
-
doGetType
Determines the type of the file, returns null if the file does not exist.- Specified by:
doGetType
in classAbstractFileObject
- Throws:
Exception
-
doListChildrenResolved
Description copied from class:AbstractFileObject
Lists the children of this file. Is only called ifAbstractFileObject.doGetType()
returnsFileType.FOLDER
. The return value of this method is cached, so the implementation can be expensive.
Other thandoListChildren
you could return FileObject's to e.g. reinitialize the type of the file.
(Introduced for Webdav: "permission denied on resource" during getType())- Overrides:
doListChildrenResolved
in classAbstractFileObject
- Throws:
Exception
-
doListChildren
Lists the children of the file.- Specified by:
doListChildren
in classAbstractFileObject
- Throws:
Exception
-
doDelete
Deletes the file.- Overrides:
doDelete
in classAbstractFileObject
- Throws:
Exception
-
doRename
Renames the file- Overrides:
doRename
in classAbstractFileObject
- Throws:
Exception
-
doCreateFolder
Creates this file as a folder.- Overrides:
doCreateFolder
in classAbstractFileObject
- Throws:
Exception
-
doGetContentSize
Returns the size of the file content (in bytes).- Specified by:
doGetContentSize
in classAbstractFileObject
- Throws:
Exception
-
doGetLastModifiedTime
get the last modified time on an ftp file- Overrides:
doGetLastModifiedTime
in classAbstractFileObject
- Throws:
Exception
- See Also:
-
doGetInputStream
Creates an input stream to read the file content from.- Specified by:
doGetInputStream
in classAbstractFileObject
- Throws:
Exception
-
doGetRandomAccessContent
Description copied from class:AbstractFileObject
Creates access to the file for random i/o. Is only called ifAbstractFileObject.doGetType()
returnsFileType.FILE
.It is guaranteed that there are no open output streams for this file when this method is called.
- Overrides:
doGetRandomAccessContent
in classAbstractFileObject
- Throws:
Exception
-
doGetOutputStream
Creates an output stream to write the file content to.- Overrides:
doGetOutputStream
in classAbstractFileObject
- Throws:
Exception
-