Class JarArchiveInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.commons.compress.archivers.ArchiveInputStream<ZipArchiveEntry>
-
- org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
-
- org.apache.commons.compress.archivers.jar.JarArchiveInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,InputStreamStatistics
public class JarArchiveInputStream extends ZipArchiveInputStream
Implements an input stream that can read entries from jar files.
-
-
Field Summary
-
Fields inherited from class org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
PREAMBLE_GARBAGE_MAX_SIZE
-
-
Constructor Summary
Constructors Constructor Description JarArchiveInputStream(java.io.InputStream inputStream)
Creates an instance from the input stream using the default encoding.JarArchiveInputStream(java.io.InputStream inputStream, java.lang.String encoding)
Creates an instance from the input stream using the specified encoding.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JarArchiveEntry
getNextEntry()
Gets the next Archive Entry in this Stream.JarArchiveEntry
getNextJarEntry()
Deprecated.UsegetNextEntry()
.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, setExtraFieldSupport, skip
-
Methods inherited from class org.apache.commons.compress.archivers.ArchiveInputStream
getBytesRead, getCharset, getCount, mark, markSupported, read, reset
-
-
-
-
Constructor Detail
-
JarArchiveInputStream
public JarArchiveInputStream(java.io.InputStream inputStream)
Creates an instance from the input stream using the default encoding.- Parameters:
inputStream
- the input stream to wrap
-
JarArchiveInputStream
public JarArchiveInputStream(java.io.InputStream inputStream, java.lang.String encoding)
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 Detail
-
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
-
getNextEntry
public JarArchiveEntry getNextEntry() throws java.io.IOException
Description copied from class:ArchiveInputStream
Gets the next Archive Entry in this Stream.- Overrides:
getNextEntry
in classZipArchiveInputStream
- Returns:
- the next entry, or
null
if there are no more entries - Throws:
java.io.IOException
- if the next entry could not be read
-
getNextJarEntry
@Deprecated public JarArchiveEntry getNextJarEntry() throws java.io.IOException
Deprecated.UsegetNextEntry()
.Gets the next entry.- Returns:
- the next entry.
- Throws:
java.io.IOException
- if an I/O error occurs.
-
-