Class ZipFileSystem
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractFileSystem
org.apache.commons.vfs2.provider.zip.ZipFileSystem
- All Implemented Interfaces:
Closeable, AutoCloseable, FileSystem, VfsComponent
- Direct Known Subclasses:
JarFileSystem
A read-only file system for ZIP and JAR files.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZipFileSystem(AbstractFileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCapabilities(Collection<Capability> caps) Returns the capabilities of this file system.protected FileObjectcreateFile(AbstractFileName name) Creates a file object.protected ZipFilecreateZipFile(File file) protected ZipFileObjectcreateZipFileObject(AbstractFileName name, ZipEntry entry) protected voidCloses the underlying link used to access the files.protected Charsetprotected FileObjectgetFileFromCache(FileName name) Returns a cached file.protected ZipFilevoidinit()Initializes this component.protected voidputFileToCache(FileObject file) Adds a file object to the cache.protected voidremoveFileFromCache(FileName name) remove a cached file.toString()Methods inherited from class AbstractFileSystem
addJunction, addListener, close, closeCommunicationLink, decorateFileObject, doReplicateFile, fireFileChanged, fireFileCreated, fireFileDeleted, getAttribute, getFileSystemManager, getFileSystemOptions, getLastModTimeAccuracy, getParentLayer, getRoot, getRootName, getRootURI, hasCapability, isOpen, isReleaseable, notifyAllStreamsClosed, removeJunction, removeListener, replicateFile, resolveFile, resolveFile, setAttributeMethods inherited from class AbstractVfsComponent
getContext, getLogger, setContext, setLogger
-
Field Details
-
ENC
private final char[] ENC -
LOG
private static final org.apache.commons.logging.Log LOG -
file
-
charset
-
zipFile
-
cache
Cache doesn't need to be synchronized since it is read-only.
-
-
Constructor Details
-
ZipFileSystem
public ZipFileSystem(AbstractFileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) throws FileSystemException - Throws:
FileSystemException
-
-
Method Details
-
init
Description copied from class:AbstractFileSystemInitializes this component.- Specified by:
initin interfaceVfsComponent- Overrides:
initin classAbstractFileSystem- Throws:
FileSystemException- if an error occurs.
-
getZipFile
- Throws:
FileSystemException
-
createZipFileObject
protected ZipFileObject createZipFileObject(AbstractFileName name, ZipEntry entry) throws FileSystemException - Throws:
FileSystemException
-
createZipFile
- Throws:
FileSystemException
-
doCloseCommunicationLink
protected void doCloseCommunicationLink()Description copied from class:AbstractFileSystemCloses the underlying link used to access the files.- Overrides:
doCloseCommunicationLinkin classAbstractFileSystem
-
addCapabilities
Returns the capabilities of this file system.- Specified by:
addCapabilitiesin classAbstractFileSystem- Parameters:
caps- collections of Capabilities, can be immutable.
-
createFile
Creates a file object.- Specified by:
createFilein classAbstractFileSystem- Parameters:
name- name referencing the new file.- Returns:
- new created FileObject.
- Throws:
FileSystemException
-
putFileToCache
Adds a file object to the cache.- Overrides:
putFileToCachein classAbstractFileSystem- Parameters:
file- the file to add.
-
getCharset
-
getFileFromCache
Returns a cached file.- Overrides:
getFileFromCachein classAbstractFileSystem- Parameters:
name- name to search for.- Returns:
- file object or null if not found.
-
removeFileFromCache
remove a cached file.- Overrides:
removeFileFromCachein classAbstractFileSystem- Parameters:
name- The file name to remove.
-
toString
-