JarArchiveInputStream
Date: 2017-02-08

org.apache.commons.compress.archivers.jar

## 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:
    java.io.Closeable, java.lang.AutoCloseable

      public class JarArchiveInputStream
      extends ZipArchiveInputStream

  Implements an input stream that can read entries from jar files.

- - ### Constructor Summary

    Constructors
    Constructor and 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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ArchiveEntry` | `getNextEntry()` Returns the next Archive Entry in this Stream.
    `JarArchiveEntry` | `getNextJarEntry()`
    `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, getNextZipEntry, 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, reset`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 wrap
        `encoding` - the encoding to use
      Since:
        1.10

  - ### Method Detail

    - #### getNextJarEntry

          public JarArchiveEntry getNextJarEntry()
                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getNextEntry

          public ArchiveEntry getNextEntry()
                                    throws java.io.IOException

      Description copied from class: `ArchiveInputStream`
      Returns the next Archive Entry in this Stream.
      Overrides:
        `getNextEntry` in class `ZipArchiveInputStream`
      Returns:
        the next entry, or `null` if there are no more entries
      Throws:
        `java.io.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 check
        `length` - the number of bytes to check
      Returns:
        true, if this stream is a jar archive stream, false otherwise