Class ZipBrowser
java.lang.Object
com.pnfsoftware.jeb.util.encoding.zip.ZipBrowser
- All Implemented Interfaces:
IGenericZipBrowser,AutoCloseable
An implementation of a Zip browser that uses the standard JDK implementation and falls back to
the Apache Commons implementation on error.
-
Constructor Summary
ConstructorsConstructorDescriptionZipBrowser(File f) Open a Zip archive, using the JDK implementation first and Apache Commons on fallback. -
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
-
ZipBrowser
Open a Zip archive, using the JDK implementation first and Apache Commons on fallback.- Parameters:
f- Zip file- 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
-