Class FramedLZ4CompressorOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.compress.compressors.CompressorOutputStream<OutputStream>
org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
CompressorOutputStream for the LZ4 frame format.
Based on the "spec" in the version "1.5.1 (31/03/2015)"
- Since:
- 1.14
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe block sizes supported by the format.static classParameters of the LZ4 frame format. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final byte[]private final org.apache.commons.codec.digest.XXHash32private intprivate final org.apache.commons.codec.digest.XXHash32private intprivate static final byte[]private booleanprivate final byte[]private final FramedLZ4CompressorOutputStream.ParametersFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionprivate voidappendToBlockDependencyBuffer(byte[] b, int off, int len) voidclose()voidfinish()Compresses all blockDataRemaining data and writes it to the stream, doesn't close the underlying stream.private voidvoidwrite(byte[] data, int off, int len) voidwrite(int b) private voidprivate voidMethods inherited from class org.apache.commons.compress.compressors.CompressorOutputStream
outMethods inherited from class java.io.FilterOutputStream
flush, write
-
Field Details
-
END_MARK
private static final byte[] END_MARK -
oneByte
private final byte[] oneByte -
blockData
private final byte[] blockData -
params
-
finished
private boolean finished -
contentHash
private final org.apache.commons.codec.digest.XXHash32 contentHash -
blockHash
private final org.apache.commons.codec.digest.XXHash32 blockHash -
blockDependencyBuffer
private final byte[] blockDependencyBuffer -
collectedBlockDependencyBytes
private int collectedBlockDependencyBytes -
currentIndex
private int currentIndex
-
-
Constructor Details
-
FramedLZ4CompressorOutputStream
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 dataparams- the parameters to use- Throws:
IOException- if writing the signature fails
-
-
Method Details
-
appendToBlockDependencyBuffer
private void appendToBlockDependencyBuffer(byte[] b, int off, int len) -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
finish
Compresses all blockDataRemaining data and writes it to the stream, doesn't close the underlying stream.- Throws:
IOException- if an error occurs
-
flushBlock
- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
writeFrameDescriptor
- Throws:
IOException
-
writeTrailer
- Throws:
IOException
-