org.apache.commons.vfs.provider.ftp
Class FtpFileObject

java.lang.Object
  extended byorg.apache.commons.vfs.provider.AbstractFileObject
      extended byorg.apache.commons.vfs.provider.ftp.FtpFileObject
All Implemented Interfaces:
FileObject

public class FtpFileObject
extends AbstractFileObject

An FTP file.

Version:
$Revision: 227247 $ $Date: 2005-08-03 20:47:36 +0200 (Wed, 03 Aug 2005) $
Author:
Adam Murdoch

Constructor Summary
protected FtpFileObject(FileName name, FtpFileSystem fileSystem, FileName rootName)
           
 
Method Summary
protected  void doAttach()
          Attaches this file object to its file resource.
protected  void doCreateFolder()
          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 doGetContentSize()
          Returns the size of the file content (in bytes).
protected  InputStream doGetInputStream()
          Creates an input stream to read the file content from.
protected  long doGetLastModifiedTime()
          get the last modified time on an ftp file
protected  OutputStream doGetOutputStream(boolean bAppend)
          Creates an output stream to write the file content to.
protected  RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode)
          Creates access to the file for random i/o.
protected  FileType doGetType()
          Determines the type of the file, returns null if the file does not exist.
protected  String[] doListChildren()
          Lists the children of the file.
protected  FileObject[] doListChildrenResolved()
          Lists the children of this file.
protected  void doRename(FileObject newfile)
          Renames the file
protected  void doSetLastModifiedTime(long modtime)
          get the last modified time on an ftp file
protected  void onChange()
          Called when the type or content of this file changes.
protected  void onChildrenChanged()
          Called when the children of this file change.
 
Methods inherited from class org.apache.commons.vfs.provider.AbstractFileObject
canRenameTo, childrenChanged, close, copyFrom, createFile, createFolder, delete, delete, doGetAttributes, doGetCertificates, doIsHidden, doIsReadable, doIsWriteable, doSetAttribute, endOutput, exists, findFiles, findFiles, getChild, getChildren, getContent, getFileContentInfoFactory, getFileSystem, getInputStream, getName, getOutputStream, getOutputStream, getParent, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isHidden, isReadable, isWriteable, moveTo, resolveFile, resolveFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FtpFileObject

protected FtpFileObject(FileName name,
                        FtpFileSystem fileSystem,
                        FileName rootName)
                 throws FileSystemException
Method Detail

doAttach

protected void doAttach()
                 throws IOException
Attaches this file object to its file resource.

Overrides:
doAttach in class AbstractFileObject
Throws:
IOException

doDetach

protected void doDetach()
Detaches this file object from its file resource.

Overrides:
doDetach in class AbstractFileObject

onChildrenChanged

protected void onChildrenChanged()
Called when the children of this file change.

Overrides:
onChildrenChanged in class AbstractFileObject

onChange

protected void onChange()
                 throws IOException
Called when the type or content of this file changes.

Overrides:
onChange in class AbstractFileObject
Throws:
IOException

doGetType

protected FileType doGetType()
                      throws Exception
Determines the type of the file, returns null if the file does not exist.

Specified by:
doGetType in class AbstractFileObject
Throws:
Exception

doListChildrenResolved

protected FileObject[] doListChildrenResolved()
                                       throws Exception
Description copied from class: AbstractFileObject
Lists the children of this file. Is only called if AbstractFileObject.doGetType() returns FileType.FOLDER. The return value of this method is cached, so the implementation can be expensive.
Other than doListChildren 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 class AbstractFileObject
Throws:
Exception

doListChildren

protected String[] doListChildren()
                           throws Exception
Lists the children of the file.

Specified by:
doListChildren in class AbstractFileObject
Throws:
Exception

doDelete

protected void doDelete()
                 throws Exception
Deletes the file.

Overrides:
doDelete in class AbstractFileObject
Throws:
Exception

doRename

protected void doRename(FileObject newfile)
                 throws Exception
Renames the file

Overrides:
doRename in class AbstractFileObject
Throws:
Exception

doCreateFolder

protected void doCreateFolder()
                       throws Exception
Creates this file as a folder.

Overrides:
doCreateFolder in class AbstractFileObject
Throws:
Exception

doGetContentSize

protected long doGetContentSize()
                         throws Exception
Returns the size of the file content (in bytes).

Specified by:
doGetContentSize in class AbstractFileObject
Throws:
Exception

doGetLastModifiedTime

protected long doGetLastModifiedTime()
                              throws Exception
get the last modified time on an ftp file

Overrides:
doGetLastModifiedTime in class AbstractFileObject
Throws:
Exception
See Also:
AbstractFileObject.doGetLastModifiedTime()

doSetLastModifiedTime

protected void doSetLastModifiedTime(long modtime)
                              throws Exception
get the last modified time on an ftp file

Overrides:
doSetLastModifiedTime in class AbstractFileObject
Parameters:
modtime - the time to set on the ftp file
Throws:
Exception
See Also:
AbstractFileObject.doSetLastModifiedTime(long)

doGetInputStream

protected InputStream doGetInputStream()
                                throws Exception
Creates an input stream to read the file content from.

Specified by:
doGetInputStream in class AbstractFileObject
Throws:
Exception

doGetRandomAccessContent

protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode)
                                                throws Exception
Description copied from class: AbstractFileObject
Creates access to the file for random i/o. Is only called if AbstractFileObject.doGetType() returns FileType.FILE.

It is guaranteed that there are no open output streams for this file when this method is called.

Overrides:
doGetRandomAccessContent in class AbstractFileObject
Throws:
Exception

doGetOutputStream

protected OutputStream doGetOutputStream(boolean bAppend)
                                  throws Exception
Creates an output stream to write the file content to.

Overrides:
doGetOutputStream in class AbstractFileObject
Throws:
Exception


Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.