public final class ZstdEncoder extends MessageToByteEncoder<ByteBuf>
ChannelHandler.Sharable
构造器和说明 |
---|
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) |
限定符和类型 | 方法和说明 |
---|---|
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
在类中 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
在类中 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
在接口中 ChannelOutboundHandler
flush
在类中 ChannelOutboundHandlerAdapter
ctx
- the ChannelHandlerContext
for which the flush operation is madepublic void handlerAdded(ChannelHandlerContext ctx)
ChannelHandlerAdapter
handlerAdded
在接口中 ChannelHandler
handlerAdded
在类中 ChannelHandlerAdapter
public void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerRemoved
在接口中 ChannelHandler
handlerRemoved
在类中 ChannelHandlerAdapter
java.lang.Exception