public class BlockLZ4CompressorOutputStream extends CompressorOutputStream
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
BlockLZ4CompressorOutputStream.Pair |
| Modifier and Type | Field and Description |
|---|---|
private LZ77Compressor |
compressor |
private java.util.Deque<byte[]> |
expandedBlocks |
private boolean |
finished |
private static int |
MIN_BACK_REFERENCE_LENGTH |
private static int |
MIN_OFFSET_OF_LAST_BACK_REFERENCE |
private byte[] |
oneByte |
private java.io.OutputStream |
os |
private java.util.Deque<BlockLZ4CompressorOutputStream.Pair> |
pairs |
| Constructor and 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.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addBackReference(LZ77Compressor.BackReference block) |
private void |
addLiteralBlock(LZ77Compressor.LiteralBlock block) |
private void |
clearUnusedBlocks() |
private void |
clearUnusedBlocksAndPairs() |
private void |
clearUnusedPairs() |
void |
close() |
static Parameters.Builder |
createParameterBuilder()
Returns a builder correctly configured for the LZ4 algorithm.
|
private byte[] |
expand(int offset,
int length) |
private void |
expandFromList(byte[] expanded,
int offset,
int length) |
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.
|
private void |
recordBackReference(LZ77Compressor.BackReference block) |
private void |
recordLiteral(byte[] b) |
private void |
rewriteLastPairs() |
void |
write(byte[] data,
int off,
int len) |
void |
write(int b) |
private BlockLZ4CompressorOutputStream.Pair |
writeBlocksAndReturnUnfinishedPair(int length) |
private void |
writeFinalLiteralBlock() |
private void |
writeWritablePairs(int lengthOfBlocksAfterLastPair) |
private static final int MIN_BACK_REFERENCE_LENGTH
private static final int MIN_OFFSET_OF_LAST_BACK_REFERENCE
private final LZ77Compressor compressor
private final java.io.OutputStream os
private final byte[] oneByte
private boolean finished
private java.util.Deque<BlockLZ4CompressorOutputStream.Pair> pairs
private java.util.Deque<byte[]> expandedBlocks
public BlockLZ4CompressorOutputStream(java.io.OutputStream os)
throws java.io.IOException
os - An OutputStream to read compressed data fromjava.io.IOException - if reading failspublic BlockLZ4CompressorOutputStream(java.io.OutputStream os,
Parameters params)
throws java.io.IOException
os - An OutputStream to read compressed data fromparams - The parameters to use for LZ77 compression.java.io.IOException - if reading failspublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] data,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic void finish()
throws java.io.IOException
java.io.IOException - if an error occurspublic void prefill(byte[] data,
int off,
int len)
data - the data to fill the window with.off - offset of real data into the arraylen - amount of datajava.lang.IllegalStateException - if the stream has already started to write dataLZ77Compressor.prefill(byte[])private void addLiteralBlock(LZ77Compressor.LiteralBlock block) throws java.io.IOException
java.io.IOExceptionprivate void addBackReference(LZ77Compressor.BackReference block) throws java.io.IOException
java.io.IOExceptionprivate BlockLZ4CompressorOutputStream.Pair writeBlocksAndReturnUnfinishedPair(int length) throws java.io.IOException
java.io.IOExceptionprivate void recordLiteral(byte[] b)
private void clearUnusedBlocksAndPairs()
private void clearUnusedBlocks()
private void recordBackReference(LZ77Compressor.BackReference block)
private byte[] expand(int offset,
int length)
private void expandFromList(byte[] expanded,
int offset,
int length)
private void clearUnusedPairs()
private void writeFinalLiteralBlock()
throws java.io.IOException
java.io.IOExceptionprivate void writeWritablePairs(int lengthOfBlocksAfterLastPair)
throws java.io.IOException
java.io.IOExceptionprivate void rewriteLastPairs()
public static Parameters.Builder createParameterBuilder()