org.apache.commons.vfs.provider.zip
Class ZipFileObject

java.lang.Object
  extended by org.apache.commons.vfs.provider.AbstractFileObject
      extended by org.apache.commons.vfs.provider.zip.ZipFileObject
All Implemented Interfaces:
FileObject
Direct Known Subclasses:
JarFileObject

public class ZipFileObject
extends AbstractFileObject
implements FileObject

A file in a Zip file system.

Version:
$Revision: 659785 $ $Date: 2008-05-24 12:32:41 +0200(sab, 24 mag 2008) $
Author:
Adam Murdoch

Field Summary
protected  ZipEntry entry
           
 
Constructor Summary
protected ZipFileObject(FileName name, ZipEntry entry, ZipFileSystem fs, boolean zipExists)
           
 
Method Summary
 void attachChild(FileName childName)
          Attaches a child
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()
          Returns the last modified time of this file.
protected  FileType doGetType()
          Returns the file's type.
protected  String[] doListChildren()
          Lists the children of the file.
 boolean isWriteable()
          Determines if this file can be written to.
protected  void setZipEntry(ZipEntry entry)
          Sets the details for this file object.
 
Methods inherited from class org.apache.commons.vfs.provider.AbstractFileObject
canRenameTo, childrenChanged, childrenChanged, close, copyFrom, createFile, createFolder, delete, delete, doAttach, doCreateFileContent, doCreateFolder, doDelete, doDetach, doGetAttributes, doGetCertificates, doGetOutputStream, doGetRandomAccessContent, doIsHidden, doIsReadable, doIsSameFile, doIsWriteable, doListChildrenResolved, doRemoveAttribute, doRename, doSetAttribute, doSetLastModifiedTime, doSetLastModTime, 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, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.vfs.FileObject
canRenameTo, close, copyFrom, createFile, createFolder, delete, delete, exists, findFiles, findFiles, getChild, getChildren, getContent, getFileOperations, getFileSystem, getName, getParent, getType, getURL, isAttached, isContentOpen, isHidden, isReadable, moveTo, refresh, resolveFile, resolveFile
 

Field Detail

entry

protected ZipEntry entry
Constructor Detail

ZipFileObject

protected ZipFileObject(FileName name,
                        ZipEntry entry,
                        ZipFileSystem fs,
                        boolean zipExists)
                 throws FileSystemException
Throws:
FileSystemException
Method Detail

setZipEntry

protected void setZipEntry(ZipEntry entry)
Sets the details for this file object.


attachChild

public void attachChild(FileName childName)
Attaches a child


isWriteable

public boolean isWriteable()
                    throws FileSystemException
Determines if this file can be written to.

Specified by:
isWriteable in interface FileObject
Overrides:
isWriteable in class AbstractFileObject
Returns:
true if this file is writeable, false if not.
Throws:
FileSystemException - if an error occurs.

doGetType

protected FileType doGetType()
Returns the file's type.

Specified by:
doGetType in class AbstractFileObject

doListChildren

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

Specified by:
doListChildren in class AbstractFileObject
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

doGetContentSize

protected long doGetContentSize()
Returns the size of the file content (in bytes). Is only called if doGetType() returns FileType.FILE.

Specified by:
doGetContentSize in class AbstractFileObject

doGetLastModifiedTime

protected long doGetLastModifiedTime()
                              throws Exception
Returns the last modified time of this file.

Overrides:
doGetLastModifiedTime in class AbstractFileObject
Throws:
Exception

doGetInputStream

protected InputStream doGetInputStream()
                                throws Exception
Creates an input stream to read the file content from. Is only called if doGetType() returns FileType.FILE. The input stream returned by this method is guaranteed to be closed before this method is called again.

Specified by:
doGetInputStream in class AbstractFileObject
Throws:
Exception


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.