Class ZstdEncoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
-
- io.netty.handler.codec.compression.ZstdEncoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelOutboundHandler
public final class ZstdEncoder extends io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>Compresses aByteBufusing the Zstandard algorithm. See Zstandard.
-
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.netty.buffer.ByteBufallocateBuffer(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg, boolean preferDirect)protected voidencode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)voidflush(io.netty.channel.ChannelHandlerContext ctx)voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)voidhandlerRemoved(io.netty.channel.ChannelHandlerContext ctx)-
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, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, isSharable
-
-
-
-
Constructor Detail
-
ZstdEncoder
public ZstdEncoder()
Creates a new Zstd encoder. Please note that if you use the default constructor, the default BLOCK_SIZE and MAX_BLOCK_SIZE will be used. If you want to specify BLOCK_SIZE and MAX_BLOCK_SIZE yourself, please useZstdEncoder(int,int)constructor
-
ZstdEncoder
public ZstdEncoder(int compressionLevel)
Creates a new Zstd encoder.- Parameters:
compressionLevel- specifies the level of the compression
-
ZstdEncoder
public ZstdEncoder(int blockSize, int maxEncodeSize)Creates a new Zstd encoder.- Parameters:
blockSize- is used to calculate the compressionLevelmaxEncodeSize- specifies the size of the largest compressed object
-
ZstdEncoder
public ZstdEncoder(int compressionLevel, int blockSize, int maxEncodeSize)- Parameters:
blockSize- is used to calculate the compressionLevelmaxEncodeSize- specifies the size of the largest compressed objectcompressionLevel- specifies the level of the compression
-
-
Method Detail
-
allocateBuffer
protected io.netty.buffer.ByteBuf allocateBuffer(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf msg, boolean preferDirect)- Overrides:
allocateBufferin classio.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)- Specified by:
encodein classio.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
-
flush
public void flush(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
flushin classio.netty.channel.ChannelOutboundHandlerAdapter
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter
-
-