Class BlockLZ4CompressorOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.compress.compressors.CompressorOutputStream
-
- org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class BlockLZ4CompressorOutputStream extends CompressorOutputStream
CompressorOutputStream for the LZ4 block format.- Since:
- 1.14
- See Also:
- LZ4 Block Format Description
-
-
Constructor Summary
Constructors Constructor Description BlockLZ4CompressorOutputStream(java.io.OutputStream os)Creates a new LZ4 output stream.BlockLZ4CompressorOutputStream(java.io.OutputStream os, Parameters params)Creates a new LZ4 output stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static Parameters.BuildercreateParameterBuilder()Returns a builder correctly configured for the LZ4 algorithm.voidfinish()Compresses all remaining data and writes it to the stream, doesn't close the underlying stream.voidprefill(byte[] data, int off, int len)Adds some initial data to fill the window with.voidwrite(byte[] data, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
BlockLZ4CompressorOutputStream
public BlockLZ4CompressorOutputStream(java.io.OutputStream os)
Creates a new LZ4 output stream.- Parameters:
os- An OutputStream to read compressed data from
-
BlockLZ4CompressorOutputStream
public BlockLZ4CompressorOutputStream(java.io.OutputStream os, Parameters params)Creates a new LZ4 output stream.- Parameters:
os- An OutputStream to read compressed data fromparams- The parameters to use for LZ77 compression.
-
-
Method Detail
-
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 java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionCompresses all remaining data and writes it to the stream, doesn't close the underlying stream.- Throws:
java.io.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 arraylen- amount of data- Throws:
java.lang.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 java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
-