Class FtpFileObject
- java.lang.Object
-
- org.apache.commons.vfs.provider.AbstractFileObject
-
- org.apache.commons.vfs.provider.ftp.FtpFileObject
-
- All Implemented Interfaces:
FileObject
public class FtpFileObject extends AbstractFileObject
An FTP file.- Version:
- $Revision: 484943 $ $Date: 2006-12-09 08:42:06 +0100 (Sat, 09 Dec 2006) $
- Author:
- Adam Murdoch
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFtpFileObject(FileName name, FtpFileSystem fileSystem, FileName rootName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoAttach()Attaches this file object to its file resource.protected voiddoCreateFolder()Creates this file as a folder.protected voiddoDelete()Deletes the file.protected voiddoDetach()Detaches this file object from its file resource.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()get the last modified time on an ftp fileprotected java.io.OutputStreamdoGetOutputStream(boolean bAppend)Creates an output stream to write the file content to.protected RandomAccessContentdoGetRandomAccessContent(RandomAccessMode mode)Creates access to the file for random i/o.protected FileTypedoGetType()Determines the type of the file, returns null if the file does not exist.protected java.lang.String[]doListChildren()Lists the children of the file.protected FileObject[]doListChildrenResolved()Lists the children of this file.protected voiddoRename(FileObject newfile)Renames the fileprotected voidonChange()Called when the type or content of this file changes.protected voidonChildrenChanged(FileName child, FileType newType)Called when the children of this file change.voidrefresh()This will prepare the fileObject to get resynchronized with the underlaying filesystem if required-
Methods 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 Detail
-
FtpFileObject
protected FtpFileObject(FileName name, FtpFileSystem fileSystem, FileName rootName) throws FileSystemException
- Throws:
FileSystemException
-
-
Method Detail
-
doAttach
protected void doAttach() throws java.io.IOExceptionAttaches this file object to its file resource.- Overrides:
doAttachin classAbstractFileObject- Throws:
java.io.IOException
-
refresh
public void refresh() throws FileSystemExceptionDescription copied from class:AbstractFileObjectThis will prepare the fileObject to get resynchronized with the underlaying filesystem if required- Specified by:
refreshin interfaceFileObject- Overrides:
refreshin classAbstractFileObject- Throws:
FileSystemException
-
doDetach
protected void doDetach()
Detaches this file object from its file resource.- Overrides:
doDetachin classAbstractFileObject
-
onChildrenChanged
protected void onChildrenChanged(FileName child, FileType newType)
Called when the children of this file change.- Overrides:
onChildrenChangedin classAbstractFileObject
-
onChange
protected void onChange() throws java.io.IOExceptionCalled when the type or content of this file changes.- Overrides:
onChangein classAbstractFileObject- Throws:
java.io.IOException
-
doGetType
protected FileType doGetType() throws java.lang.Exception
Determines the type of the file, returns null if the file does not exist.- Specified by:
doGetTypein classAbstractFileObject- Throws:
java.lang.Exception
-
doListChildrenResolved
protected FileObject[] doListChildrenResolved() throws java.lang.Exception
Description copied from class:AbstractFileObjectLists 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 thandoListChildrenyou could return FileObject's to e.g. reinitialize the type of the file.
(Introduced for Webdav: "permission denied on resource" during getType())- Overrides:
doListChildrenResolvedin classAbstractFileObject- Throws:
java.lang.Exception
-
doListChildren
protected java.lang.String[] doListChildren() throws java.lang.ExceptionLists the children of the file.- Specified by:
doListChildrenin classAbstractFileObject- Throws:
java.lang.Exception
-
doDelete
protected void doDelete() throws java.lang.ExceptionDeletes the file.- Overrides:
doDeletein classAbstractFileObject- Throws:
java.lang.Exception
-
doRename
protected void doRename(FileObject newfile) throws java.lang.Exception
Renames the file- Overrides:
doRenamein 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
-
doGetContentSize
protected long doGetContentSize() throws java.lang.ExceptionReturns the size of the file content (in bytes).- Specified by:
doGetContentSizein classAbstractFileObject- Throws:
java.lang.Exception
-
doGetLastModifiedTime
protected long doGetLastModifiedTime() throws java.lang.Exceptionget the last modified time on an ftp file- Overrides:
doGetLastModifiedTimein classAbstractFileObject- Throws:
java.lang.Exception- See Also:
AbstractFileObject.doGetLastModifiedTime()
-
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
-
doGetRandomAccessContent
protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode) throws java.lang.Exception
Description copied from class:AbstractFileObjectCreates 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:
doGetRandomAccessContentin 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
-
-