public final class ZstdEncoder extends MessageToByteEncoder<io.netty.buffer.ByteBuf>
ByteBuf
using the Zstandard algorithm.
See Zstandard.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 io.netty.buffer.ByteBuf |
allocateBuffer(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf msg,
boolean preferDirect)
Allocate a
ByteBuf which will be used as argument of #encode(ChannelHandlerContext, I, ByteBuf) . |
protected void |
encode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
io.netty.buffer.ByteBuf out)
Encode a message into a
ByteBuf . |
void |
flush(io.netty.channel.ChannelHandlerContext ctx) |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) |
acceptOutboundMessage, isPreferDirect, write
bind, close, connect, deregister, disconnect, read
ensureNotSharable, exceptionCaught, isSharable
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 io.netty.buffer.ByteBuf allocateBuffer(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.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<io.netty.buffer.ByteBuf>
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<io.netty.buffer.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(io.netty.channel.ChannelHandlerContext ctx)
flush
in interface io.netty.channel.ChannelOutboundHandler
flush
in class io.netty.channel.ChannelOutboundHandlerAdapter
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
handlerAdded
in interface io.netty.channel.ChannelHandler
handlerAdded
in class io.netty.channel.ChannelHandlerAdapter
Copyright © 2008–2021 The Netty Project. All rights reserved.