Package org.apache.commons.compress.compressors.lz4

# Class BlockLZ4CompressorOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.compress.CompressFilterOutputStream<OutputStream>
org.apache.commons.compress.compressors.CompressorOutputStream<OutputStream>
org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public class BlockLZ4CompressorOutputStream extends CompressorOutputStream<OutputStream>
CompressorOutputStream for the LZ4 block format.

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

- ## Field Summary

  ### Fields inherited from class java.io.FilterOutputStream

  `out`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BlockLZ4CompressorOutputStream(OutputStream out)`
  Creates a new LZ4 output stream.
  `BlockLZ4CompressorOutputStream(OutputStream out, Parameters params)`
  Creates a new LZ4 output stream.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `static Parameters.Builder`
  `createParameterBuilder()`
  Returns a builder correctly configured for the LZ4 algorithm.
  `void`
  `finish()`
  Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.
  `void`
  `prefill(byte[] data, int off, int len)`
  Adds some initial data to fill the window with.
  `void`
  `write(byte[] data, int off, int len)`
  `void`
  `write(int b)`

  ### Methods inherited from class org.apache.commons.compress.CompressFilterOutputStream

  `checkOpen, isClosed, isFinished, out, write, write, writeUsAscii, writeUsAsciiRaw, writeUtf8`

  ### Methods inherited from class java.io.FilterOutputStream

  `flush, write`

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

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

- ## Constructor Details

  - ### BlockLZ4CompressorOutputStream

    public BlockLZ4CompressorOutputStream(OutputStream out)
    Creates a new LZ4 output stream.
    Parameters:
      `out` - An OutputStream to read compressed data from

  - ### BlockLZ4CompressorOutputStream

    public BlockLZ4CompressorOutputStream(OutputStream out, Parameters params)
    Creates a new LZ4 output stream.
    Parameters:
      `out` - An OutputStream to read compressed data from
      `params` - The parameters to use for LZ77 compression.

- ## Method Details

  - ### createParameterBuilder

    public static Parameters.Builder createParameterBuilder()
    Returns a builder correctly configured for the LZ4 algorithm.
    Returns:
      a builder correctly configured for the LZ4 algorithm

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Overrides:
      `close` in class `CompressFilterOutputStream<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.
    Overrides:
      `finish` in class `CompressFilterOutputStream<OutputStream>`
    Throws:
      `IOException` - if an error occurs

  - ### prefill

    public void prefill(byte[] data, int off, int len)
    Adds some initial data to fill the window with.
    Parameters:
      `data` - the data to fill the window with.
      `off` - offset of real data into the array
      `len` - amount of data
    Throws:
      `IllegalStateException` - if the stream has already started to write data
    See Also:
      - `LZ77Compressor.prefill(byte[])`

  - ### write

    public void write(byte[] data, int off, int len) throws IOException
    Overrides:
      `write` in class `FilterOutputStream`
    Throws:
      `IOException`

  - ### write

    public void write(int b) throws IOException
    Overrides:
      `write` in class `FilterOutputStream`
    Throws:
      `IOException`