public class LzmaFrameEncoder extends MessageToByteEncoder<ByteBuf>
ByteBuf using the LZMA algorithm.
See LZMA
and LZMA format
or documents in LZMA SDK archive.ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_LC |
private static int |
DEFAULT_LP |
private static int |
DEFAULT_MATCH_FINDER |
private static int |
DEFAULT_PB |
private lzma.sdk.lzma.Encoder |
encoder
Underlying LZMA encoder in use.
|
private int |
littleEndianDictionarySize
Dictionary Size is stored as an unsigned 32-bit little endian integer.
|
private static InternalLogger |
logger |
private static int |
MAX_FAST_BYTES |
private static int |
MEDIUM_DICTIONARY_SIZE |
private static int |
MEDIUM_FAST_BYTES |
private static int |
MIN_FAST_BYTES |
private byte |
properties
The Properties field contains three properties which are encoded using the following formula:
|
private static boolean |
warningLogged
For log warning only once.
|
| Constructor and Description |
|---|
LzmaFrameEncoder()
Creates LZMA encoder with default settings.
|
LzmaFrameEncoder(int dictionarySize)
|
LzmaFrameEncoder(int lc,
int lp,
int pb)
|
LzmaFrameEncoder(int lc,
int lp,
int pb,
int dictionarySize)
Creates LZMA encoder with specified
lc, lp, pb values and custom dictionary size. |
LzmaFrameEncoder(int lc,
int lp,
int pb,
int dictionarySize,
boolean endMarkerMode,
int numFastBytes)
Creates LZMA encoder with specified settings.
|
| Modifier and Type | Method and Description |
|---|---|
protected ByteBuf |
allocateBuffer(ChannelHandlerContext ctx,
ByteBuf in,
boolean preferDirect)
Allocate a
ByteBuf which will be used as argument of #encode(ChannelHandlerContext, I, ByteBuf). |
protected void |
encode(ChannelHandlerContext ctx,
ByteBuf in,
ByteBuf out)
Encode a message into a
ByteBuf. |
private static int |
maxOutputBufferLength(int inputLength)
Calculates maximum possible size of output buffer for not compressible data.
|
acceptOutboundMessage, isPreferDirect, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedprivate static final InternalLogger logger
private static final int MEDIUM_DICTIONARY_SIZE
private static final int MIN_FAST_BYTES
private static final int MEDIUM_FAST_BYTES
private static final int MAX_FAST_BYTES
private static final int DEFAULT_MATCH_FINDER
private static final int DEFAULT_LC
private static final int DEFAULT_LP
private static final int DEFAULT_PB
private final lzma.sdk.lzma.Encoder encoder
private final byte properties
Properties = (pb * 5 + lp) * 9 + lc
private final int littleEndianDictionarySize
private static boolean warningLogged
public LzmaFrameEncoder()
public LzmaFrameEncoder(int lc,
int lp,
int pb)
public LzmaFrameEncoder(int dictionarySize)
public LzmaFrameEncoder(int lc,
int lp,
int pb,
int dictionarySize)
lc, lp, pb values and custom dictionary size.public LzmaFrameEncoder(int lc,
int lp,
int pb,
int dictionarySize,
boolean endMarkerMode,
int numFastBytes)
lc - the number of "literal context" bits, available values [0, 8], default value 3.lp - the number of "literal position" bits, available values [0, 4], default value 0.pb - the number of "position" bits, available values [0, 4], default value 2.dictionarySize - available values [0, Integer.MAX_VALUE],
default value is 65536.endMarkerMode - indicates should LzmaFrameEncoder use end of stream marker or not.
Note, that LzmaFrameEncoder always sets size of uncompressed data
in LZMA header, so EOS marker is unnecessary. But you may use it for
better portability. For full description see "LZMA Decoding modes" section
of LZMA-Specification.txt in official LZMA SDK.numFastBytes - available values [5, 273].protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoderByteBuf. This method will be called for each written message that can be handled
by this encoder.encode in class MessageToByteEncoder<ByteBuf>ctx - the ChannelHandlerContext which this MessageToByteEncoder belongs toin - the message to encodeout - the ByteBuf into which the encoded message will be writtenjava.lang.Exception - is thrown if an error occursprotected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf in, boolean preferDirect) throws java.lang.Exception
MessageToByteEncoderByteBuf which will be used as argument of #encode(ChannelHandlerContext, I, ByteBuf).
Sub-classes may override this method to return ByteBuf with a perfect matching initialCapacity.allocateBuffer in class MessageToByteEncoder<ByteBuf>java.lang.Exceptionprivate static int maxOutputBufferLength(int inputLength)