org.apache.commons.compress.compressors.lz4

## Class FramedLZ4CompressorOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.commons.compress.compressors.CompressorOutputStream
    - - org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class FramedLZ4CompressorOutputStream
      extends CompressorOutputStream

  CompressorOutputStream for the LZ4 frame format.

  Based on the "spec" in the version "1.5.1 (31/03/2015)"

  Since:
    1.14
  See Also:
    LZ4 Frame Format Description
  This class is not thread-safe

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FramedLZ4CompressorOutputStream.BlockSize` The block sizes supported by the format.
    `static class` | `FramedLZ4CompressorOutputStream.Parameters` Parameters of the LZ4 frame format.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FramedLZ4CompressorOutputStream(OutputStream out)` Constructs a new output stream that compresses data using the LZ4 frame format using the default block size of 4MB.
    `FramedLZ4CompressorOutputStream(OutputStream out, FramedLZ4CompressorOutputStream.Parameters params)` Constructs a new output stream that compresses data using the LZ4 frame format using the given block size.

  - ### 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

    - #### FramedLZ4CompressorOutputStream

          public FramedLZ4CompressorOutputStream(OutputStream out)
                                          throws IOException

      Constructs a new output stream that compresses data using the LZ4 frame format using the default block size of 4MB.
      Parameters:
        `out` - the OutputStream to which to write the compressed data
      Throws:
        `IOException` - if writing the signature fails

    - #### FramedLZ4CompressorOutputStream

          public FramedLZ4CompressorOutputStream(OutputStream out,
                                                 FramedLZ4CompressorOutputStream.Parameters params)
                                          throws IOException

      Constructs a new output stream that compresses data using the LZ4 frame format using the given block size.
      Parameters:
        `out` - the OutputStream to which to write the compressed data
        `params` - the parameters to use
      Throws:
        `IOException` - if writing the signature fails

  - ### Method Detail

    - #### 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

    - #### write

          public void write(byte[] data,
                            int off,
                            int len)
                     throws IOException

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

    - #### write

          public void write(int b)
                     throws IOException

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

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