GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Deprecated
  • Index
  • Search
  • Help
  • io.netty.handler.codec.compression
  • JZlibEncoder

This view

  • Original page
  • New address

GeezerVison is showing netty.io — JZlibEncoder (Netty API Reference (4.1.141.Final))

Class JZlibEncoder

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
io.netty.handler.codec.MessageToByteEncoder<ByteBuf>
io.netty.handler.codec.compression.ZlibEncoder
io.netty.handler.codec.compression.JZlibEncoder
All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler

public class JZlibEncoder extends ZlibEncoder
Compresses a ByteBuf using the deflate algorithm.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface ChannelHandler

    ChannelHandler.Sharable
    Modifier and Type
    Interface
    Description
    static @interface 
    ChannelHandler.Sharable
    Indicates that the same instance of the annotated ChannelHandler can be added to one or more ChannelPipelines multiple times without a race condition.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JZlibEncoder()
    Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the default wrapper (ZlibWrapper.ZLIB).
    JZlibEncoder(byte[] dictionary)
    Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the specified preset dictionary.
    JZlibEncoder(int compressionLevel)
    Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the default wrapper (ZlibWrapper.ZLIB).
    JZlibEncoder(int compressionLevel, byte[] dictionary)
    Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the specified preset dictionary.
    JZlibEncoder(int compressionLevel, int windowBits, int memLevel, byte[] dictionary)
    Creates a new zlib encoder with the specified compressionLevel, the specified windowBits, the specified memLevel, and the specified preset dictionary.
    JZlibEncoder(ZlibWrapper wrapper)
    Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the specified wrapper.
    JZlibEncoder(ZlibWrapper wrapper, int compressionLevel)
    Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the specified wrapper.
    JZlibEncoder(ZlibWrapper wrapper, int compressionLevel, int windowBits, int memLevel)
    Creates a new zlib encoder with the specified compressionLevel, the specified windowBits, the specified memLevel, and the specified wrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    ChannelFuture
    close()
    Close this ZlibEncoder and so finish the encoding.
    void
    close(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    ChannelFuture
    close(ChannelPromise promise)
    Close this ZlibEncoder and so finish the encoding.
    protected void
    encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
    Encode a message into a ByteBuf.
    void
    handlerAdded(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    boolean
    isClosed()
    Returns true if and only if the end of the compressed stream has been reached.

    Methods inherited from class MessageToByteEncoder

    acceptOutboundMessage, allocateBuffer, isPreferDirect, write
    Modifier and Type
    Method
    Description
    boolean
    acceptOutboundMessage(Object msg)
    Returns true if the given message should be handled.
    protected ByteBuf
    allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect)
    Allocate a ByteBuf which will be used as argument of MessageToByteEncoder.encode(ChannelHandlerContext, I, ByteBuf).
    protected boolean
    isPreferDirect()
     
    void
    write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
    Calls ChannelOutboundInvoker.write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelOutboundHandlerAdapter

    bind, connect, deregister, disconnect, flush, read
    Modifier and Type
    Method
    Description
    void
    bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.bind(SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    deregister(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.deregister(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.disconnect(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    flush(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.flush() to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    read(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.read() to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelHandlerAdapter

    ensureNotSharable, exceptionCaught, handlerRemoved, isSharable
    Modifier and Type
    Method
    Description
    protected void
    ensureNotSharable()
    Throws IllegalStateException if ChannelHandlerAdapter.isSharable() returns true
    void
    exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
    Deprecated.
    is part of ChannelInboundHandler
    void
    handlerRemoved(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    boolean
    isSharable()
    Return true if the implementation is ChannelHandler.Sharable and so can be added to different ChannelPipelines.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JZlibEncoder

      public JZlibEncoder()
      Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the default wrapper (ZlibWrapper.ZLIB).
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(int compressionLevel)
      Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the default wrapper (ZlibWrapper.ZLIB).
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression. 0 means no compression. The default compression level is 6.
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(ZlibWrapper wrapper)
      Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the specified wrapper.
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(ZlibWrapper wrapper, int compressionLevel)
      Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the specified wrapper.
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression. 0 means no compression. The default compression level is 6.
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(ZlibWrapper wrapper, int compressionLevel, int windowBits, int memLevel)
      Creates a new zlib encoder with the specified compressionLevel, the specified windowBits, the specified memLevel, and the specified wrapper.
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression. 0 means no compression. The default compression level is 6.
      windowBits - The base two logarithm of the size of the history buffer. The value should be in the range 9 to 15 inclusive. Larger values result in better compression at the expense of memory usage. The default value is 15.
      memLevel - How much memory should be allocated for the internal compression state. 1 uses minimum memory and 9 uses maximum memory. Larger values result in better and faster compression at the expense of memory usage. The default value is 8
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(byte[] dictionary)
      Creates a new zlib encoder with the default compression level (6), default window bits (15), default memory level (8), and the specified preset dictionary. The wrapper is always ZlibWrapper.ZLIB because it is the only format that supports the preset dictionary.
      Parameters:
      dictionary - the preset dictionary
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(int compressionLevel, byte[] dictionary)
      Creates a new zlib encoder with the specified compressionLevel, default window bits (15), default memory level (8), and the specified preset dictionary. The wrapper is always ZlibWrapper.ZLIB because it is the only format that supports the preset dictionary.
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression. 0 means no compression. The default compression level is 6.
      dictionary - the preset dictionary
      Throws:
      CompressionException - if failed to initialize zlib
    • JZlibEncoder

      public JZlibEncoder(int compressionLevel, int windowBits, int memLevel, byte[] dictionary)
      Creates a new zlib encoder with the specified compressionLevel, the specified windowBits, the specified memLevel, and the specified preset dictionary. The wrapper is always ZlibWrapper.ZLIB because it is the only format that supports the preset dictionary.
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression. 0 means no compression. The default compression level is 6.
      windowBits - The base two logarithm of the size of the history buffer. The value should be in the range 9 to 15 inclusive. Larger values result in better compression at the expense of memory usage. The default value is 15.
      memLevel - How much memory should be allocated for the internal compression state. 1 uses minimum memory and 9 uses maximum memory. Larger values result in better and faster compression at the expense of memory usage. The default value is 8
      dictionary - the preset dictionary
      Throws:
      CompressionException - if failed to initialize zlib
  • Method Details

    • close

      public ChannelFuture close()
      Description copied from class: ZlibEncoder
      Close this ZlibEncoder and so finish the encoding. The returned ChannelFuture will be notified once the operation completes.
      Specified by:
      close in class ZlibEncoder
    • close

      public ChannelFuture close(ChannelPromise promise)
      Description copied from class: ZlibEncoder
      Close this ZlibEncoder and so finish the encoding. The given ChannelFuture will be notified once the operation completes and will also be returned.
      Specified by:
      close in class ZlibEncoder
    • isClosed

      public boolean isClosed()
      Description copied from class: ZlibEncoder
      Returns true if and only if the end of the compressed stream has been reached.
      Specified by:
      isClosed in class ZlibEncoder
    • encode

      protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception
      Description copied from class: MessageToByteEncoder
      Encode a message into a ByteBuf. This method will be called for each written message that can be handled by this encoder.
      Specified by:
      encode in class MessageToByteEncoder<ByteBuf>
      Parameters:
      ctx - the ChannelHandlerContext which this MessageToByteEncoder belongs to
      in - the message to encode
      out - the ByteBuf into which the encoded message will be written
      Throws:
      Exception - is thrown if an error occurs
    • close

      public void close(ChannelHandlerContext ctx, ChannelPromise promise)
      Description copied from class: ChannelOutboundHandlerAdapter
      Calls ChannelOutboundInvoker.close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      close in interface ChannelOutboundHandler
      Overrides:
      close in class ChannelOutboundHandlerAdapter
      Parameters:
      ctx - the ChannelHandlerContext for which the close operation is made
      promise - the ChannelPromise to notify once the operation completes
    • handlerAdded

      public void handlerAdded(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelHandlerAdapter
      Do nothing by default, sub-classes may override this method.
      Specified by:
      handlerAdded in interface ChannelHandler
      Overrides:
      handlerAdded in class ChannelHandlerAdapter
      Throws:
      Exception
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.