Class LzmaFrameEncoder

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

    public class LzmaFrameEncoder
    extends io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
    Compresses a ByteBuf using the LZMA algorithm. See LZMA and LZMA format or documents in LZMA SDK archive.
    • Nested Class Summary

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

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

      Constructors 
      Constructor Description
      LzmaFrameEncoder()
      Creates LZMA encoder with default settings.
      LzmaFrameEncoder​(int dictionarySize)
      Creates LZMA encoder with specified dictionary size and default values of lc = 3, lp = 0, pb = 2.
      LzmaFrameEncoder​(int lc, int lp, int pb)
      Creates LZMA encoder with specified lc, lp, pb values and the medium dictionary size of 65536.
      LzmaFrameEncoder​(int lc, int lp, int pb, int dictionarySize)
      Creates LZMA encoder with specified lc, lp, pb values and custom dictionary size.
      LzmaFrameEncoder​(int lc, int lp, int pb, int dictionarySize, boolean endMarkerMode, int numFastBytes)
      Creates LZMA encoder with specified settings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected io.netty.buffer.ByteBuf allocateBuffer​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, boolean preferDirect)  
      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, 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

      • LzmaFrameEncoder

        public LzmaFrameEncoder()
        Creates LZMA encoder with default settings.
      • LzmaFrameEncoder

        public LzmaFrameEncoder​(int lc,
                                int lp,
                                int pb)
        Creates LZMA encoder with specified lc, lp, pb values and the medium dictionary size of 65536.
      • LzmaFrameEncoder

        public LzmaFrameEncoder​(int dictionarySize)
        Creates LZMA encoder with specified dictionary size and default values of lc = 3, lp = 0, pb = 2.
      • LzmaFrameEncoder

        public LzmaFrameEncoder​(int lc,
                                int lp,
                                int pb,
                                int dictionarySize)
        Creates LZMA encoder with specified lc, lp, pb values and custom dictionary size.
      • LzmaFrameEncoder

        public LzmaFrameEncoder​(int lc,
                                int lp,
                                int pb,
                                int dictionarySize,
                                boolean endMarkerMode,
                                int numFastBytes)
        Creates LZMA encoder with specified settings.
        Parameters:
        lc - the number of "literal context" bits, available values [0, 8], default value 3.
        lp - the number of "literal position" bits, available values [0, 4], default value 0.
        pb - the number of "position" bits, available values [0, 4], default value 2.
        dictionarySize - available values [0, Integer.MAX_VALUE], default value is 65536.
        endMarkerMode - indicates should LzmaFrameEncoder use end of stream marker or not. Note, that LzmaFrameEncoder always sets size of uncompressed data in LZMA header, so EOS marker is unnecessary. But you may use it for better portability. For full description see "LZMA Decoding modes" section of LZMA-Specification.txt in official LZMA SDK.
        numFastBytes - available values [5, 273].
    • 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
      • allocateBuffer

        protected io.netty.buffer.ByteBuf allocateBuffer​(io.netty.channel.ChannelHandlerContext ctx,
                                                         io.netty.buffer.ByteBuf in,
                                                         boolean preferDirect)
                                                  throws Exception
        Overrides:
        allocateBuffer in class io.netty.handler.codec.MessageToByteEncoder<io.netty.buffer.ByteBuf>
        Throws:
        Exception