org.apache.commons.compress.compressors.pack200

## Class Pack200CompressorInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.commons.compress.compressors.CompressorInputStream
    - - org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStream

- All Implemented Interfaces:
    Closeable

      public class Pack200CompressorInputStream
      extends CompressorInputStream

  An input stream that decompresses from the Pack200 format to be read as any other stream.

  The `getCount` and `getBytesRead` methods always return 0.

  Since:
    1.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pack200CompressorInputStream(File f)` Decompresses the given file, caching the decompressed data in memory.
    `Pack200CompressorInputStream(File f, Map<String,String> props)` Decompresses the given file, caching the decompressed data in memory and using the given properties.
    `Pack200CompressorInputStream(File f, Pack200Strategy mode)` Decompresses the given file using the given strategy to cache the results.
    `Pack200CompressorInputStream(File f, Pack200Strategy mode, Map<String,String> props)` Decompresses the given file using the given strategy to cache the results and the given properties.
    `Pack200CompressorInputStream(InputStream in)` Decompresses the given stream, caching the decompressed data in memory.
    `Pack200CompressorInputStream(InputStream in, Map<String,String> props)` Decompresses the given stream, caching the decompressed data in memory and using the given properties.
    `Pack200CompressorInputStream(InputStream in, Pack200Strategy mode)` Decompresses the given stream using the given strategy to cache the results.
    `Pack200CompressorInputStream(InputStream in, Pack200Strategy mode, Map<String,String> props)` Decompresses the given stream using the given strategy to cache the results and the given properties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()`
    `void` | `close()`
    `void` | `mark(int limit)`
    `boolean` | `markSupported()`
    `static boolean` | `matches(byte[] signature, int length)` Checks if the signature matches what is expected for a pack200 file (0xCAFED00D).
    `int` | `read()`
    `int` | `read(byte[] b)`
    `int` | `read(byte[] b, int off, int count)`
    `void` | `reset()`
    `long` | `skip(long count)`

    - ### Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream

      `count, count, getBytesRead, getCount, pushedBackBytes`

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

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

- - ### Constructor Detail

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(InputStream in)
                                       throws IOException

      Decompresses the given stream, caching the decompressed data in memory.

      When reading from a file the File-arg constructor may provide better performance.

      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(InputStream in,
                                      Pack200Strategy mode)
                                       throws IOException

      Decompresses the given stream using the given strategy to cache the results.

      When reading from a file the File-arg constructor may provide better performance.

      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(InputStream in,
                                      Map<String,String> props)
                                       throws IOException

      Decompresses the given stream, caching the decompressed data in memory and using the given properties.

      When reading from a file the File-arg constructor may provide better performance.

      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(InputStream in,
                                      Pack200Strategy mode,
                                      Map<String,String> props)
                                       throws IOException

      Decompresses the given stream using the given strategy to cache the results and the given properties.

      When reading from a file the File-arg constructor may provide better performance.

      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(File f)
                                       throws IOException

      Decompresses the given file, caching the decompressed data in memory.
      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(File f,
                                      Pack200Strategy mode)
                                       throws IOException

      Decompresses the given file using the given strategy to cache the results.
      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(File f,
                                      Map<String,String> props)
                                       throws IOException

      Decompresses the given file, caching the decompressed data in memory and using the given properties.
      Throws:
        `IOException`

    - #### Pack200CompressorInputStream

          public Pack200CompressorInputStream(File f,
                                      Pack200Strategy mode,
                                      Map<String,String> props)
                                       throws IOException

      Decompresses the given file using the given strategy to cache the results and the given properties.
      Throws:
        `IOException`

  - ### Method Detail

    - #### read

          public int read()
                   throws IOException

      Specified by:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### read

          public int read(byte[] b)
                   throws IOException

      Overrides:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### read

          public int read(byte[] b,
                 int off,
                 int count)
                   throws IOException

      Overrides:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### available

          public int available()
                        throws IOException

      Overrides:
        `available` in class `InputStream`
      Throws:
        `IOException`

    - #### markSupported

          public boolean markSupported()

      Overrides:
        `markSupported` in class `InputStream`

    - #### mark

          public void mark(int limit)

      Overrides:
        `mark` in class `InputStream`

    - #### reset

          public void reset()
                     throws IOException

      Overrides:
        `reset` in class `InputStream`
      Throws:
        `IOException`

    - #### skip

          public long skip(long count)
                    throws IOException

      Overrides:
        `skip` in class `InputStream`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Overrides:
        `close` in class `InputStream`
      Throws:
        `IOException`

    - #### matches

          public static boolean matches(byte[] signature,
                        int length)

      Checks if the signature matches what is expected for a pack200 file (0xCAFED00D).
      Parameters:
        `signature` - the bytes to check
        `length` - the number of bytes to check
      Returns:
        true, if this stream is a pack200 compressed stream, false otherwise

Copyright © 2014 The Apache Software Foundation. All rights reserved.