org.apache.commons.compress.compressors.snappy

## Class FramedSnappyCompressorOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.commons.compress.compressors.CompressorOutputStream
    - - org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class FramedSnappyCompressorOutputStream
      extends CompressorOutputStream

  CompressorOutputStream for the framing Snappy format.

  Based on the "spec" in the version "Last revised: 2013-10-25"

  Since:
    1.14
  See Also:
    Snappy framing format description
  This class is not thread-safe

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FramedSnappyCompressorOutputStream(OutputStream out)` Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.
    `FramedSnappyCompressorOutputStream(OutputStream out, Parameters params)` Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `finish()` Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.
    `void` | `write(byte[] data, int off, int len)`
    `void` | `write(int b)`

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

      `flush, write`

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

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

- - ### Constructor Detail

    - #### FramedSnappyCompressorOutputStream

          public FramedSnappyCompressorOutputStream(OutputStream out)
                                             throws IOException

      Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.
      Parameters:
        `out` - the OutputStream to which to write the compressed data
      Throws:
        `IOException` - if writing the signature fails

    - #### FramedSnappyCompressorOutputStream

          public FramedSnappyCompressorOutputStream(OutputStream out,
                                                    Parameters params)
                                             throws IOException

      Constructs a new output stream that compresses snappy-framed-compressed data to the specified output stream.
      Parameters:
        `out` - the OutputStream to which to write the compressed data
        `params` - parameters used to fine-tune compression, in particular to balance compression ratio vs compression speed.
      Throws:
        `IOException` - if writing the signature fails

  - ### Method Detail

    - #### write

          public void write(int b)
                     throws IOException

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

    - #### write

          public void write(byte[] data,
                            int off,
                            int len)
                     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

      Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.
      Throws:
        `IOException` - if an error occurs

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.