Class Bzip2Encoder

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

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

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

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

      Constructors 
      Constructor Description
      Bzip2Encoder()
      Creates a new bzip2 encoder with the maximum (900,000 byte) block size.
      Bzip2Encoder​(int blockSizeMultiplier)
      Creates a new bzip2 encoder with the specified blockSizeMultiplier.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.netty.channel.ChannelFuture close()
      Close this Bzip2Encoder and so finish the encoding.
      void close​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)  
      io.netty.channel.ChannelFuture close​(io.netty.channel.ChannelPromise promise)
      Close this Bzip2Encoder and so finish the encoding.
      protected void encode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out)  
      void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)  
      boolean isClosed()
      Returns true if and only if the end of the compressed stream has been reached.
      • Methods inherited from class io.netty.handler.codec.MessageToByteEncoder

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

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

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

        exceptionCaught, handlerRemoved
    • Constructor Detail

      • Bzip2Encoder

        public Bzip2Encoder()
        Creates a new bzip2 encoder with the maximum (900,000 byte) block size.
      • Bzip2Encoder

        public Bzip2Encoder​(int blockSizeMultiplier)
        Creates a new bzip2 encoder with the specified blockSizeMultiplier.
        Parameters:
        blockSizeMultiplier - The Bzip2 block size as a multiple of 100,000 bytes (minimum 1, maximum 9). Larger block sizes require more memory for both compression and decompression, but give better compression ratios. 9 will usually be the best value to use.
    • 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
      • isClosed

        public boolean isClosed()
        Returns true if and only if the end of the compressed stream has been reached.
      • close

        public io.netty.channel.ChannelFuture close()
        Close this Bzip2Encoder and so finish the encoding. The returned ChannelFuture will be notified once the operation completes.
      • close

        public io.netty.channel.ChannelFuture close​(io.netty.channel.ChannelPromise promise)
        Close this Bzip2Encoder and so finish the encoding. The given ChannelFuture will be notified once the operation completes and will also be returned.
      • close

        public void close​(io.netty.channel.ChannelHandlerContext ctx,
                          io.netty.channel.ChannelPromise promise)
                   throws Exception
        Specified by:
        close in interface io.netty.channel.ChannelOutboundHandler
        Overrides:
        close in class io.netty.channel.ChannelOutboundHandlerAdapter
        Throws:
        Exception
      • handlerAdded

        public void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Overrides:
        handlerAdded in class io.netty.channel.ChannelHandlerAdapter
        Throws:
        Exception