public final class ZstdEncoder extends MessageToByteEncoder<ByteBuf>
ChannelHandler.Sharable
Constructor and Description |
---|
ZstdEncoder()
Creates a new Zstd encoder.
|
ZstdEncoder(int compressionLevel)
Creates a new Zstd encoder.
|
ZstdEncoder(int blockSize,
int maxEncodeSize)
Creates a new Zstd encoder.
|
ZstdEncoder(int compressionLevel,
int blockSize,
int maxEncodeSize) |
Modifier and Type | Method and Description |
---|---|
protected ByteBuf |
allocateBuffer(ChannelHandlerContext ctx,
ByteBuf msg,
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 . |
void |
flush(ChannelHandlerContext ctx)
Calls
ChannelHandlerContext.flush() to forward
to the next ChannelOutboundHandler in the ChannelPipeline . |
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
void |
handlerRemoved(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
acceptOutboundMessage, isPreferDirect, write
bind, close, connect, deregister, disconnect, read
ensureNotSharable, exceptionCaught, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught
public ZstdEncoder()
ZstdEncoder(int,int)
constructorpublic ZstdEncoder(int compressionLevel)
compressionLevel
- specifies the level of the compressionpublic ZstdEncoder(int blockSize, int maxEncodeSize)
blockSize
- is used to calculate the compressionLevelmaxEncodeSize
- specifies the size of the largest compressed objectpublic ZstdEncoder(int compressionLevel, int blockSize, int maxEncodeSize)
blockSize
- is used to calculate the compressionLevelmaxEncodeSize
- specifies the size of the largest compressed objectcompressionLevel
- specifies the level of the compressionprotected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect)
MessageToByteEncoder
ByteBuf
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>
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
MessageToByteEncoder
ByteBuf
. 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 writtenpublic void flush(ChannelHandlerContext ctx)
ChannelOutboundHandlerAdapter
ChannelHandlerContext.flush()
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.flush
in interface ChannelOutboundHandler
flush
in class ChannelOutboundHandlerAdapter
ctx
- the ChannelHandlerContext
for which the flush operation is madepublic void handlerAdded(ChannelHandlerContext ctx)
ChannelHandlerAdapter
handlerAdded
in interface ChannelHandler
handlerAdded
in class ChannelHandlerAdapter
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapter
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class ChannelHandlerAdapter
Exception
Copyright © 2008–2024 The Netty Project. All rights reserved.