Class ZstdEncoder
java.lang.Object
- All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionprotected ByteBufallocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) Allocate aByteBufwhich will be used as argument ofMessageToByteEncoder.encode(ChannelHandlerContext, I, ByteBuf).protected voidencode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) Encode a message into aByteBuf.voidCallsChannelHandlerContext.flush()to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidDo nothing by default, sub-classes may override this method.voidDo nothing by default, sub-classes may override this method.Methods inherited from class MessageToByteEncoder
acceptOutboundMessage, isPreferDirect, writeMethods inherited from class ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, readMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
exceptionCaught
-
Constructor Details
-
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:
compressionLevel- specifies the level of the compressionblockSize- is used to calculate the compressionLevelmaxEncodeSize- specifies the size of the largest compressed object
-
-
Method Details
-
allocateBuffer
Description copied from class:MessageToByteEncoderAllocate aByteBufwhich will be used as argument ofMessageToByteEncoder.encode(ChannelHandlerContext, I, ByteBuf). Sub-classes may override this method to returnByteBufwith a perfect matchinginitialCapacity.- Overrides:
allocateBufferin classMessageToByteEncoder<ByteBuf>
-
encode
Description copied from class:MessageToByteEncoderEncode a message into aByteBuf. This method will be called for each written message that can be handled by this encoder.- Specified by:
encodein classMessageToByteEncoder<ByteBuf>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToByteEncoderbelongs toin- the message to encodeout- theByteBufinto which the encoded message will be written
-
flush
Description copied from class:ChannelOutboundHandlerAdapterCallsChannelHandlerContext.flush()to forward to the nextChannelOutboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
flushin interfaceChannelOutboundHandler- Overrides:
flushin classChannelOutboundHandlerAdapter- Parameters:
ctx- theChannelHandlerContextfor which the flush operation is made
-
handlerAdded
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerAddedin interfaceChannelHandler- Overrides:
handlerAddedin classChannelHandlerAdapter
-
handlerRemoved
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerRemovedin interfaceChannelHandler- Overrides:
handlerRemovedin classChannelHandlerAdapter- Throws:
Exception
-