Class ZipFileObject
java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileObject<ZipFileSystem>
org.apache.commons.vfs2.provider.zip.ZipFileObject
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Comparable<FileObject>,- Iterable<FileObject>,- FileObject
- Direct Known Subclasses:
- JarFileObject
A file in a ZIP file system.
- 
Field SummaryFieldsFields inherited from class org.apache.commons.vfs2.provider.AbstractFileObjectDEFAULT_BUFFER_SIZEFields inherited from interface org.apache.commons.vfs2.FileObjectEMPTY_ARRAY
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedZipFileObject(AbstractFileName fileName, ZipEntry entry, ZipFileSystem fileSystem, boolean zipExists) Constructs a new instance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidattachChild(FileName childName) Attaches a child.protected voiddoAttach()Attaches this file object to its file resource.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 longReturns the last modified time of this file.protected FileTypeReturns the file's type.protected String[]Lists the children of the file.booleanDetermines if this file can be written to.protected voidsetZipEntry(ZipEntry entry) Sets the details for this file object.Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileObjectcanRenameTo, childrenChanged, close, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doCreateFileContent, doCreateFolder, doDelete, doGetAttributes, doGetCertificates, doGetInputStream, doGetOutputStream, doGetRandomAccessContent, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doIsSymbolicLink, doIsWriteable, doListChildrenResolved, doRemoveAttribute, doRename, doSetAttribute, doSetExecutable, doSetLastModifiedTime, doSetReadable, doSetWritable, endOutput, exists, finalize, findFiles, findFiles, getAbstractFileSystem, getChild, getChildren, 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, iterator, listFiles, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, 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
- 
Field Details- 
entryThe ZipEntry.
 
- 
- 
Constructor Details- 
ZipFileObjectprotected ZipFileObject(AbstractFileName fileName, ZipEntry entry, ZipFileSystem fileSystem, boolean zipExists) Constructs a new instance.- Parameters:
- fileName- the file name.
- entry- The zip entry.
- fileSystem- the file system.
- zipExists- whether the zip file exists.
 
 
- 
- 
Method Details- 
attachChildAttaches a child.TODO: Shouldn't this method have package-only visibility? Cannot change this without breaking binary compatibility. - Parameters:
- childName- The name of the child.
 
- 
doAttachDescription copied from class:AbstractFileObjectAttaches this file object to its file resource.This method is called before any of the doBlah() or onBlah() methods. Sub-classes can use this method to perform lazy initialization. This implementation does nothing. - Overrides:
- doAttachin class- AbstractFileObject<ZipFileSystem>
- Throws:
- Exception- if an error occurs.
 
- 
doDetachDescription copied from class:AbstractFileObjectDetaches this file object from its file resource.Called when this file is closed. Note that the file object may be reused later, so should be able to be reattached. This implementation does nothing. - Overrides:
- doDetachin class- AbstractFileObject<ZipFileSystem>
- Throws:
- Exception- if an error occurs.
 
- 
doGetContentSizeReturns the size of the file content (in bytes). Is only called ifdoGetType()returnsFileType.FILE.- Specified by:
- doGetContentSizein class- AbstractFileObject<ZipFileSystem>
- Returns:
- The size of the file in bytes.
 
- 
doGetInputStreamCreates an input stream to read the file content from. Is only called ifdoGetType()returnsFileType.FILE. The input stream returned by this method is guaranteed to be closed before this method is called again.- Overrides:
- doGetInputStreamin class- AbstractFileObject<ZipFileSystem>
- Parameters:
- bufferSize- Buffer size hint.
- Returns:
- An InputStream to read the file content.
- Throws:
- Exception- if an error occurs.
 
- 
doGetLastModifiedTimeReturns the last modified time of this file.- Overrides:
- doGetLastModifiedTimein class- AbstractFileObject<ZipFileSystem>
- Returns:
- The last modification time.
- Throws:
- Exception- if an error occurs.
 
- 
doGetTypeReturns the file's type.- Specified by:
- doGetTypein class- AbstractFileObject<ZipFileSystem>
- Returns:
- the type of the file.
 
- 
doListChildrenLists the children of the file.- Specified by:
- doListChildrenin class- AbstractFileObject<ZipFileSystem>
- 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.
 
- 
isWriteableDetermines if this file can be written to.- Specified by:
- isWriteablein interface- FileObject
- Overrides:
- isWriteablein class- AbstractFileObject<ZipFileSystem>
- Returns:
- trueif this file is writable,- falseif not.
- Throws:
- FileSystemException- if an error occurs.
 
- 
setZipEntrySets the details for this file object.- Parameters:
- entry- ZIP information related to this file.
 
 
-