Class JarBrowser
java.lang.Object
com.pnfsoftware.jeb.util.encoding.zip.JarBrowser
- All Implemented Interfaces:
IGenericJarBrowser,IGenericZipBrowser,AutoCloseable
An implementation of a Jar browser that uses the standard JDK implementation and falls back to
the Apache Commons implementation on error.
-
Constructor Summary
ConstructorsConstructorDescriptionJarBrowser(File f, boolean verify) Open a Jar 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.getCertificates(String name) Get the certificates associated with a Jar entry.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
-
JarBrowser
Open a Jar archive, using the JDK implementation first and Apache Commons on fallback.- Parameters:
f- Jar fileverify- true to verify signed entries when supported by the backing implementation- 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
-
getCertificates
Description copied from interface:IGenericJarBrowserGet the certificates associated with a Jar entry.- Specified by:
getCertificatesin interfaceIGenericJarBrowser- Parameters:
name- entry name- Returns:
- certificate chain, or null if unavailable
-