Class FastLzFrameEncoder

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelOutboundHandler

    public class FastLzFrameEncoder
    extends io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
    Compresses a ByteBuf using the FastLZ algorithm. See FastLZ format.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Constructor Summary

      Constructors 
      Constructor Description
      FastLzFrameEncoder()
      Creates a FastLZ encoder without checksum calculator and with auto detection of compression level.
      FastLzFrameEncoder​(boolean validateChecksums)
      Creates a FastLZ encoder with auto detection of compression level and calculation of checksums as specified.
      FastLzFrameEncoder​(int level)
      Creates a FastLZ encoder with specified compression level and without checksum calculator.
      FastLzFrameEncoder​(int level, Checksum checksum)
      Creates a FastLZ encoder with specified compression level and checksum calculator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void encode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)  
      • Methods inherited from class io.netty.handler.codec.MessageToByteEncoder

        acceptOutboundMessage, allocateBuffer, isPreferDirect, write
      • Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter

        bind, close, connect, deregister, disconnect, flush, read
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface io.netty.channel.ChannelHandler

        exceptionCaught, handlerAdded, handlerRemoved
    • Constructor Detail

      • FastLzFrameEncoder

        public FastLzFrameEncoder()
        Creates a FastLZ encoder without checksum calculator and with auto detection of compression level.
      • FastLzFrameEncoder

        public FastLzFrameEncoder​(int level)
        Creates a FastLZ encoder with specified compression level and without checksum calculator.
        Parameters:
        level - supports only these values: 0 - Encoder will choose level automatically depending on the length of the input buffer. 1 - Level 1 is the fastest compression and generally useful for short data. 2 - Level 2 is slightly slower but it gives better compression ratio.
      • FastLzFrameEncoder

        public FastLzFrameEncoder​(boolean validateChecksums)
        Creates a FastLZ encoder with auto detection of compression level and calculation of checksums as specified.
        Parameters:
        validateChecksums - If true, the checksum of each block will be calculated and this value will be added to the header of block. By default FastLzFrameEncoder uses Adler32 for checksum calculation.
      • FastLzFrameEncoder

        public FastLzFrameEncoder​(int level,
                                  Checksum checksum)
        Creates a FastLZ encoder with specified compression level and checksum calculator.
        Parameters:
        level - supports only these values: 0 - Encoder will choose level automatically depending on the length of the input buffer. 1 - Level 1 is the fastest compression and generally useful for short data. 2 - Level 2 is slightly slower but it gives better compression ratio.
        checksum - the Checksum instance to use to check data for integrity. You may set null if you don't want to validate checksum of each block.
    • Method Detail

      • encode

        protected void encode​(io.netty.channel.ChannelHandlerContext ctx,
                              io.netty.buffer.ByteBuf in,
                              io.netty.buffer.ByteBuf out)
                       throws Exception
        Specified by:
        encode in class io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
        Throws:
        Exception