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.
- 
Constructor SummaryConstructorsConstructorDescriptionZipFileSystem(AbstractFileName rootFileName, FileObject parentLayer, FileSystemOptions fileSystemOptions) Constructs a new instance.
- 
Method SummaryModifier 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) Creates a Zip file.protected ZipFileObjectcreateZipFileObject(AbstractFileName fileName, ZipEntry entry) Creates a new Zip file object.protected voidCloses the underlying link used to access the files.protected CharsetGets the Charset, defaults toStandardCharsets.UTF_8, the value used inZipFile.protected FileObjectgetFileFromCache(FileName name) Gets a cached file.protected ZipFileGets the zip file.voidinit()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 org.apache.commons.vfs2.provider.AbstractFileSystemaddJunction, 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 org.apache.commons.vfs2.provider.AbstractVfsComponentgetContext, getLogger, setContext, setLogger
- 
Constructor Details- 
ZipFileSystempublic ZipFileSystem(AbstractFileName rootFileName, FileObject parentLayer, FileSystemOptions fileSystemOptions) throws FileSystemException Constructs a new instance.- Parameters:
- rootFileName- The root file name of this file system.
- parentLayer- The parent layer of this file system.
- fileSystemOptions- Options to build this file system.
- Throws:
- FileSystemException- If the parent layer does not exist, or on error replicating the file.
 
 
- 
- 
Method Details- 
addCapabilitiesReturns the capabilities of this file system.- Specified by:
- addCapabilitiesin class- AbstractFileSystem
- Parameters:
- caps- collections of Capabilities, can be immutable.
 
- 
createFileCreates a file object.- Specified by:
- createFilein class- AbstractFileSystem
- Parameters:
- name- name referencing the new file.
- Returns:
- new created FileObject.
- Throws:
- FileSystemException
 
- 
createZipFileCreates a Zip file.- Parameters:
- file- the underlying file.
- Returns:
- a Zip file.
- Throws:
- FileSystemException- if a file system error occurs.
 
- 
createZipFileObjectprotected ZipFileObject createZipFileObject(AbstractFileName fileName, ZipEntry entry) throws FileSystemException Creates a new Zip file object.- Parameters:
- fileName- the underlying file.
- entry- the Zip entry.
- Returns:
- a new ZipFileObject.
- Throws:
- FileSystemException- if a file system error occurs.
 
- 
doCloseCommunicationLinkDescription copied from class:AbstractFileSystemCloses the underlying link used to access the files.- Overrides:
- doCloseCommunicationLinkin class- AbstractFileSystem
 
- 
getCharsetGets the Charset, defaults toStandardCharsets.UTF_8, the value used inZipFile.- Returns:
- the Charset.
 
- 
getFileFromCacheGets a cached file.- Overrides:
- getFileFromCachein class- AbstractFileSystem
- Parameters:
- name- name to search for.
- Returns:
- file object or null if not found.
 
- 
getZipFileGets the zip file.- Returns:
- the zip file.
- Throws:
- FileSystemException- if a file system error occurs.
 
- 
initDescription copied from class:AbstractFileSystemInitializes this component.- Specified by:
- initin interface- VfsComponent
- Overrides:
- initin class- AbstractFileSystem
- Throws:
- FileSystemException- if an error occurs.
 
- 
putFileToCacheAdds a file object to the cache.- Overrides:
- putFileToCachein class- AbstractFileSystem
- Parameters:
- file- the file to add.
 
- 
removeFileFromCacheremove a cached file.- Overrides:
- removeFileFromCachein class- AbstractFileSystem
- Parameters:
- name- The file name to remove.
 
- 
toString
 
-