Class FtpFileObject
java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileObject<FtpFileSystem>
org.apache.commons.vfs2.provider.ftp.FtpFileObject
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Comparable<FileObject>,- Iterable<FileObject>,- FileObject
An FTP file.
- 
Field SummaryFields inherited from class org.apache.commons.vfs2.provider.AbstractFileObjectDEFAULT_BUFFER_SIZEFields inherited from interface org.apache.commons.vfs2.FileObjectEMPTY_ARRAY
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedFtpFileObject(AbstractFileName fileName, FtpFileSystem fileSystem, FileName rootName) Constructs a new instance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddoAttach()Attaches this file object to its file resource.protected voidCreates this file as a folder.protected voiddoDelete()Deletes the file.protected voiddoDetach()Detaches this file object from its file resource.protected longReturns the size of the file content (in bytes).protected InputStreamdoGetInputStream(int bufferSize) Creates an input stream to read the file content from.protected longGets the last modified time on an FTP fileprotected OutputStreamdoGetOutputStream(boolean bAppend) Creates an output stream to write the file content to.protected RandomAccessContentCreates access to the file for random i/o.protected FileTypeDetermines 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 voiddoRename(FileObject newFile) Renames the fileReturns the file's list of children.protected 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 underlying file system if required.Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileObjectcanRenameTo, childrenChanged, close, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doCreateFileContent, doGetAttributes, doGetCertificates, doGetInputStream, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doIsSymbolicLink, doIsWriteable, doRemoveAttribute, doSetAttribute, doSetExecutable, doSetLastModifiedTime, doSetReadable, doSetWritable, endOutput, exists, finalize, findFiles, findFiles, getAbstractFileSystem, getChild, getContent, getFileContentInfoFactory, getFileOperations, getFileSystem, getInputStream, getInputStream, getName, getOutputStream, getOutputStream, getParent, getPublicURIString, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isExecutable, isFile, isFolder, isHidden, isReadable, isSameFile, isSymbolicLink, isWriteable, iterator, listFiles, moveTo, notifyAllStreamsClosed, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toStringMethods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.vfs2.FileObjectgetPath, getURIMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
FtpFileObjectprotected FtpFileObject(AbstractFileName fileName, FtpFileSystem fileSystem, FileName rootName) throws FileSystemException Constructs a new instance.- Parameters:
- fileName- the file name.
- fileSystem- the file system.
- rootName- the root name.
- Throws:
- FileSystemException- if an file system error occurs.
 
 
- 
- 
Method Details- 
doAttachAttaches this file object to its file resource.- Overrides:
- doAttachin class- AbstractFileObject<FtpFileSystem>
- Throws:
- IOException
 
- 
doCreateFolderCreates this file as a folder.- Overrides:
- doCreateFolderin class- AbstractFileObject<FtpFileSystem>
- Throws:
- Exception- if an error occurs.
 
- 
doDeleteDeletes the file.- Overrides:
- doDeletein class- AbstractFileObject<FtpFileSystem>
- Throws:
- Exception- if an error occurs.
 
- 
doDetachDetaches this file object from its file resource.- Overrides:
- doDetachin class- AbstractFileObject<FtpFileSystem>
 
- 
doGetContentSizeReturns the size of the file content (in bytes).- Specified by:
- doGetContentSizein class- AbstractFileObject<FtpFileSystem>
- Returns:
- The size of the file in bytes.
- Throws:
- Exception- if an error occurs.
 
- 
doGetInputStreamCreates an input stream to read the file content from.- Overrides:
- doGetInputStreamin class- AbstractFileObject<FtpFileSystem>
- Parameters:
- bufferSize- Buffer size hint.
- Returns:
- An InputStream to read the file content.
- Throws:
- Exception- if an error occurs.
 
- 
doGetLastModifiedTimeGets the last modified time on an FTP file- Overrides:
- doGetLastModifiedTimein class- AbstractFileObject<FtpFileSystem>
- Returns:
- The last modification time.
- Throws:
- Exception- if an error occurs.
- See Also:
 
- 
doGetOutputStreamCreates an output stream to write the file content to.- Overrides:
- doGetOutputStreamin class- AbstractFileObject<FtpFileSystem>
- Parameters:
- bAppend- true if the file should be appended to, false if it should be overwritten.
- Returns:
- An OutputStream to write to the file.
- Throws:
- Exception- if an error occurs.
 
- 
doGetRandomAccessContentDescription 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 class- AbstractFileObject<FtpFileSystem>
- Parameters:
- mode- The mode to access the file.
- Returns:
- The RandomAccessContext.
- Throws:
- Exception- if an error occurs.
 
- 
doGetTypeDetermines the type of the file, returns null if the file does not exist.- Specified by:
- doGetTypein class- AbstractFileObject<FtpFileSystem>
- Returns:
- the type of the file.
- Throws:
- Exception- if an error occurs.
 
- 
doListChildrenLists the children of the file.- Specified by:
- doListChildrenin class- AbstractFileObject<FtpFileSystem>
- Returns:
- a possible empty String array if the file is a directory or null or an exception if the file is not a directory or can't be read.
- Throws:
- Exception- if an error occurs.
 
- 
doListChildrenResolvedDescription copied from class:AbstractFileObjectLists the children of this file.Is only called if AbstractFileObject.doGetType()returnsFileType.FOLDER.The return value of this method is cached, so the implementation can be expensive. Other than doListChildrenyou could return FileObject's to e.g. reinitialize the type of the file.(Introduced for WebDAV: "permission denied on resource" during getType()) - Overrides:
- doListChildrenResolvedin class- AbstractFileObject<FtpFileSystem>
- Returns:
- The children of this FileObject.
- Throws:
- Exception- if an error occurs.
 
- 
doRenameRenames the file- Overrides:
- doRenamein class- AbstractFileObject<FtpFileSystem>
- Parameters:
- newFile- A FileObject with the new file name.
- Throws:
- Exception- if an error occurs.
 
- 
getChildrenReturns the file's list of children.- Specified by:
- getChildrenin interface- FileObject
- Overrides:
- getChildrenin class- AbstractFileObject<FtpFileSystem>
- Returns:
- The list of children
- Throws:
- FileSystemException- If there was a problem listing children
- Since:
- 2.0
- See Also:
 
- 
onChangeCalled when the type or content of this file changes.- Overrides:
- onChangein class- AbstractFileObject<FtpFileSystem>
- Throws:
- IOException
 
- 
onChildrenChangedCalled when the children of this file change.- Overrides:
- onChildrenChangedin class- AbstractFileObject<FtpFileSystem>
- Parameters:
- child- The name of the child that changed.
- newType- The type of the file.
 
- 
refreshDescription copied from class:AbstractFileObjectThis will prepare the fileObject to get resynchronized with the underlying file system if required.- Specified by:
- refreshin interface- FileObject
- Overrides:
- refreshin class- AbstractFileObject<FtpFileSystem>
- Throws:
- FileSystemException- if an error occurs.
 
 
-