# Pack200CompressorOutputStream (Apache Commons Compress 1.13 API)

org.apache.commons.compress.compressors.pack200

## Class Pack200CompressorOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.commons.compress.compressors.CompressorOutputStream
    - - org.apache.commons.compress.compressors.pack200.Pack200CompressorOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class Pack200CompressorOutputStream
      extends CompressorOutputStream

  An output stream that compresses using the Pack200 format.
  Since:
    1.3
  This class is not thread-safe

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pack200CompressorOutputStream(OutputStream out)` Compresses the given stream, caching the compressed data in memory.
    `Pack200CompressorOutputStream(OutputStream out, Map<String,String> props)` Compresses the given stream, caching the compressed data in memory and using the given properties.
    `Pack200CompressorOutputStream(OutputStream out, Pack200Strategy mode)` Compresses the given stream using the given strategy to cache the results.
    `Pack200CompressorOutputStream(OutputStream out, Pack200Strategy mode, Map<String,String> props)` Compresses the given stream using the given strategy to cache the results and the given properties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `finish()`
    `void` | `write(byte[] b)`
    `void` | `write(byte[] b, int from, int length)`
    `void` | `write(int b)`

    - ### Methods inherited from class java.io.OutputStream

      `flush`

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

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

- - ### Constructor Detail

    - #### Pack200CompressorOutputStream

          public Pack200CompressorOutputStream(OutputStream out)
                                        throws IOException

      Compresses the given stream, caching the compressed data in memory.
      Parameters:
        `out` - the stream to write to
      Throws:
        `IOException` - if writing fails

    - #### Pack200CompressorOutputStream

          public Pack200CompressorOutputStream(OutputStream out,
                                       Pack200Strategy mode)
                                        throws IOException

      Compresses the given stream using the given strategy to cache the results.
      Parameters:
        `out` - the stream to write to
        `mode` - the strategy to use
      Throws:
        `IOException` - if writing fails

    - #### Pack200CompressorOutputStream

          public Pack200CompressorOutputStream(OutputStream out,
                                       Map<String,String> props)
                                        throws IOException

      Compresses the given stream, caching the compressed data in memory and using the given properties.
      Parameters:
        `out` - the stream to write to
        `props` - Pack200 properties to use
      Throws:
        `IOException` - if writing fails

    - #### Pack200CompressorOutputStream

          public Pack200CompressorOutputStream(OutputStream out,
                                       Pack200Strategy mode,
                                       Map<String,String> props)
                                        throws IOException

      Compresses the given stream using the given strategy to cache the results and the given properties.
      Parameters:
        `out` - the stream to write to
        `mode` - the strategy to use
        `props` - Pack200 properties to use
      Throws:
        `IOException` - if writing fails

  - ### Method Detail

    - #### write

          public void write(int b)
                     throws IOException

      Specified by:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] b)
                     throws IOException

      Overrides:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] b,
                   int from,
                   int length)
                     throws IOException

      Overrides:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

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

    - #### finish

          public void finish()
                      throws IOException

      Throws:
        `IOException`

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