Class LzmaFrameEncoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToByteEncoder<ByteBuf>
-
- io.netty.handler.codec.compression.LzmaFrameEncoder
-
- All Implemented Interfaces:
ChannelHandler
,ChannelOutboundHandler
public class LzmaFrameEncoder extends MessageToByteEncoder<ByteBuf>
Compresses aByteBuf
using the LZMA algorithm. See LZMA and LZMA format or documents in LZMA SDK archive.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor 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 specifiedlc
,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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ByteBuf
allocateBuffer(ChannelHandlerContext ctx, ByteBuf in, boolean preferDirect)
Allocate aByteBuf
which will be used as argument of#encode(ChannelHandlerContext, I, ByteBuf)
.protected void
encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
Encode a message into aByteBuf
.-
Methods inherited from class io.netty.handler.codec.MessageToByteEncoder
acceptOutboundMessage, isPreferDirect, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Constructor Detail
-
LzmaFrameEncoder
public LzmaFrameEncoder()
Creates LZMA encoder with default settings.
-
LzmaFrameEncoder
public LzmaFrameEncoder(int lc, int lp, int pb)
-
LzmaFrameEncoder
public LzmaFrameEncoder(int dictionarySize)
-
LzmaFrameEncoder
public LzmaFrameEncoder(int lc, int lp, int pb, int dictionarySize)
Creates LZMA encoder with specifiedlc
,lp
,pb
values and custom dictionary size.
-
LzmaFrameEncoder
public LzmaFrameEncoder(int lc, int lp, int pb, int dictionarySize, boolean endMarkerMode, int numFastBytes)
Creates LZMA encoder with specified settings.- Parameters:
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 shouldLzmaFrameEncoder
use end of stream marker or not. Note, thatLzmaFrameEncoder
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].
-
-
Method Detail
-
encode
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
Description copied from class:MessageToByteEncoder
Encode a message into aByteBuf
. This method will be called for each written message that can be handled by this encoder.- Specified by:
encode
in classMessageToByteEncoder<ByteBuf>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToByteEncoder
belongs toin
- the message to encodeout
- theByteBuf
into which the encoded message will be written- Throws:
java.lang.Exception
- is thrown if an error occurs
-
allocateBuffer
protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf in, boolean preferDirect) throws java.lang.Exception
Description copied from class:MessageToByteEncoder
Allocate aByteBuf
which will be used as argument of#encode(ChannelHandlerContext, I, ByteBuf)
. Sub-classes may override this method to returnByteBuf
with a perfect matchinginitialCapacity
.- Overrides:
allocateBuffer
in classMessageToByteEncoder<ByteBuf>
- Throws:
java.lang.Exception
-
-