Class ZipBrowserPNF
java.lang.Object
com.pnfsoftware.jeb.util.encoding.zip.ZipBrowserPNF
- All Implemented Interfaces:
IGenericZipBrowser,AutoCloseable
An implementation of a Zip browser backed by JEB's custom
fail-safe Zip
reader.-
Constructor Summary
ConstructorsConstructorDescriptionZipBrowserPNF(File f, int treatUnsupportedCompressionAsMethod, boolean ignoreEncryption) Open a Zip archive with the custom fail-safe reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the archive browser and release its backing resources.Map<String, GenericZipEntry<?>> Get the archive entries indexed by entry name.Get an archive entry by name.getEntryStream(String name) Open a stream for an archive entry.byte[]Read and decompress an archive entry.
-
Constructor Details
-
ZipBrowserPNF
public ZipBrowserPNF(File f, int treatUnsupportedCompressionAsMethod, boolean ignoreEncryption) throws IOException Open a Zip archive with the custom fail-safe reader.- Parameters:
f- Zip filetreatUnsupportedCompressionAsMethod- -1 to fail if unsupported, else a compression method id (0:treat as STORED; 8: treat as DEFLATED, etc.)ignoreEncryption- true to ignore encrypted-entry flags- Throws:
IOException- if the archive cannot be opened
-
-
Method Details
-
close
Description copied from interface:IGenericZipBrowserClose the archive browser and release its backing resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIGenericZipBrowser- Throws:
IOException- if closing failed
-
getEntries
Description copied from interface:IGenericZipBrowserGet the archive entries indexed by entry name.- Specified by:
getEntriesin interfaceIGenericZipBrowser- Returns:
- entry map
-
getEntry
Description copied from interface:IGenericZipBrowserGet an archive entry by name.- Specified by:
getEntryin interfaceIGenericZipBrowser- Parameters:
name- entry name- Returns:
- entry descriptor, or null
-
readEntry
Description copied from interface:IGenericZipBrowserRead and decompress an archive entry.- Specified by:
readEntryin interfaceIGenericZipBrowser- Parameters:
name- entry name- Returns:
- decompressed entry bytes
- Throws:
IOException- if the entry cannot be read
-
getEntryStream
Description copied from interface:IGenericZipBrowserOpen a stream for an archive entry.- Specified by:
getEntryStreamin interfaceIGenericZipBrowser- Parameters:
name- entry name- Returns:
- stream yielding decompressed entry bytes
- Throws:
IOException- if the entry cannot be opened
-