public class FramedLZ4CompressorOutputStream extends CompressorOutputStream
Based on the "spec" in the version "1.5.1 (31/03/2015)"
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.
|
Modifier and Type | Field and Description |
---|---|
private byte[] |
blockData |
private byte[] |
blockDependencyBuffer |
private XXHash32 |
blockHash |
private int |
collectedBlockDependencyBytes |
private XXHash32 |
contentHash |
private int |
currentIndex |
private static byte[] |
END_MARK |
private boolean |
finished |
private byte[] |
oneByte |
private java.io.OutputStream |
out |
private FramedLZ4CompressorOutputStream.Parameters |
params |
Constructor and Description |
---|
FramedLZ4CompressorOutputStream(java.io.OutputStream out)
Constructs a new output stream that compresses data using the
LZ4 frame format using the default block size of 4MB.
|
FramedLZ4CompressorOutputStream(java.io.OutputStream out,
FramedLZ4CompressorOutputStream.Parameters params)
Constructs a new output stream that compresses data using the
LZ4 frame format using the given block size.
|
Modifier and Type | Method and Description |
---|---|
private void |
appendToBlockDependencyBuffer(byte[] b,
int off,
int len) |
void |
close() |
void |
finish()
Compresses all remaining data and writes it to the stream,
doesn't close the underlying stream.
|
private void |
flushBlock() |
void |
write(byte[] data,
int off,
int len) |
void |
write(int b) |
private void |
writeFrameDescriptor() |
private void |
writeTrailer() |
private static final byte[] END_MARK
private final byte[] oneByte
private final byte[] blockData
private final java.io.OutputStream out
private final FramedLZ4CompressorOutputStream.Parameters params
private boolean finished
private int currentIndex
private final XXHash32 contentHash
private final XXHash32 blockHash
private byte[] blockDependencyBuffer
private int collectedBlockDependencyBytes
public FramedLZ4CompressorOutputStream(java.io.OutputStream out) throws java.io.IOException
out
- the OutputStream to which to write the compressed datajava.io.IOException
- if writing the signature failspublic FramedLZ4CompressorOutputStream(java.io.OutputStream out, FramedLZ4CompressorOutputStream.Parameters params) throws java.io.IOException
out
- the OutputStream to which to write the compressed dataparams
- the parameters to usejava.io.IOException
- if writing the signature failspublic void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] data, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void finish() throws java.io.IOException
java.io.IOException
- if an error occursprivate void writeFrameDescriptor() throws java.io.IOException
java.io.IOException
private void flushBlock() throws java.io.IOException
java.io.IOException
private void writeTrailer() throws java.io.IOException
java.io.IOException
private void appendToBlockDependencyBuffer(byte[] b, int off, int len)