Class JarArchiveInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.archivers.ArchiveInputStream
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
org.apache.commons.compress.archivers.jar.JarArchiveInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,InputStreamStatistics
Implements an input stream that can read entries from jar files.
-
Constructor Summary
ConstructorsConstructorDescriptionJarArchiveInputStream
(InputStream inputStream) Creates an instance from the input stream using the default encoding.JarArchiveInputStream
(InputStream inputStream, String encoding) Creates an instance from the input stream using the specified encoding. -
Method Summary
Modifier and TypeMethodDescriptionReturns the next Archive Entry in this Stream.static boolean
matches
(byte[] signature, int length) Checks if the signature matches what is expected for a jar file (in this case it is the same as for a zip file).Methods inherited from class org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
canReadEntryData, close, getCompressedCount, getNextZipEntry, getUncompressedCount, read, skip
Methods inherited from class org.apache.commons.compress.archivers.ArchiveInputStream
count, count, getBytesRead, getCount, pushedBackBytes, read
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, readAllBytes, readNBytes, reset, transferTo
-
Constructor Details
-
JarArchiveInputStream
Creates an instance from the input stream using the default encoding.- Parameters:
inputStream
- the input stream to wrap
-
JarArchiveInputStream
Creates an instance from the input stream using the specified encoding.- Parameters:
inputStream
- the input stream to wrapencoding
- the encoding to use- Since:
- 1.10
-
-
Method Details
-
getNextJarEntry
- Throws:
IOException
-
getNextEntry
Description copied from class:ArchiveInputStream
Returns the next Archive Entry in this Stream.- Overrides:
getNextEntry
in classZipArchiveInputStream
- Returns:
- the next entry,
or
null
if there are no more entries - Throws:
IOException
- if the next entry could not be read
-
matches
public static boolean matches(byte[] signature, int length) Checks if the signature matches what is expected for a jar file (in this case it is the same as for a zip file).- Parameters:
signature
- the bytes to checklength
- the number of bytes to check- Returns:
- true, if this stream is a jar archive stream, false otherwise
-