Class ZipBrowserOracle
java.lang.Object
com.pnfsoftware.jeb.util.encoding.zip.ZipBrowserOracle
- All Implemented Interfaces:
IGenericZipBrowser,AutoCloseable
An implementation of a Zip browser that uses the standard JDK implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]Charset names attempted, in order, when auto-detecting entry-name encoding. -
Constructor Summary
ConstructorsConstructorDescriptionOpen a zip archive and attempt to auto-detect character encoding for entry names.ZipBrowserOracle(File f, Charset charset) Open a zip archive and force the use of a given charset for entry names. -
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.
-
Field Details
-
csnamesTrylist
Charset names attempted, in order, when auto-detecting entry-name encoding.
-
-
Constructor Details
-
ZipBrowserOracle
Open a zip archive and attempt to auto-detect character encoding for entry names. (Currently, only the entries incsnamesTrylistare tried).- Parameters:
f- Zip file- Throws:
IOException- if the archive cannot be opened
-
ZipBrowserOracle
Open a zip archive and force the use of a given charset for entry names.- Parameters:
f- Zip filecharset- charset used to decode entry names- 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
-