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
  • LzfEncoder

This view

  • Original page
  • New address

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

Class LzfEncoder

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

public class LzfEncoder extends MessageToByteEncoder<ByteBuf>
Compresses a ByteBuf using the LZF format.

See original LZF package and LZF format for full description.

  • 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
    LzfEncoder()
    Creates a new LZF encoder with the most optimal available methods for underlying data access.
    LzfEncoder(boolean safeInstance)
    Deprecated.
    Use the constructor without the safeInstance parameter.
    LzfEncoder(boolean safeInstance, int totalLength)
    Deprecated.
    Use the constructor without the safeInstance parameter.
    LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold)
    Deprecated.
    Use the constructor without the safeInstance parameter.
    LzfEncoder(int totalLength)
    Creates a new LZF encoder with specified total length of encoded chunk.
    LzfEncoder(int totalLength, int compressThreshold)
    Creates a new LZF encoder with specified settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
    Encode a message into a ByteBuf.
    void
    handlerRemoved(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.

    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, close, 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
    close(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.close(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, handlerAdded, 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
    handlerAdded(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

    • LzfEncoder

      public LzfEncoder()
      Creates a new LZF encoder with the most optimal available methods for underlying data access. It will "unsafe" instance if one can be used on current JVM. It should be safe to call this constructor as implementations are dynamically loaded; however, on some non-standard platforms it may be necessary to use LzfEncoder(boolean) with true param.
    • LzfEncoder

      @Deprecated public LzfEncoder(boolean safeInstance)
      Deprecated.
      Use the constructor without the safeInstance parameter.
      Creates a new LZF encoder with specified encoding instance.
      Parameters:
      safeInstance - If true encoder will use ChunkEncoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise encoder will try to use highly optimized ChunkEncoder implementation that uses Sun JDK's Unsafe class (which may be included by other JDK's as well).
    • LzfEncoder

      @Deprecated public LzfEncoder(boolean safeInstance, int totalLength)
      Deprecated.
      Use the constructor without the safeInstance parameter.
      Creates a new LZF encoder with specified encoding instance and compressThreshold.
      Parameters:
      safeInstance - If true encoder will use ChunkEncoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise encoder will try to use highly optimized ChunkEncoder implementation that uses Sun JDK's Unsafe class (which may be included by other JDK's as well).
      totalLength - Expected total length of content to compress; only matters for outgoing messages that is smaller than maximum chunk size (64k), to optimize encoding hash tables.
    • LzfEncoder

      public LzfEncoder(int totalLength)
      Creates a new LZF encoder with specified total length of encoded chunk. You can configure it to encode your data flow more efficient if you know the average size of messages that you send.
      Parameters:
      totalLength - Expected total length of content to compress; only matters for outgoing messages that is smaller than maximum chunk size (64k), to optimize encoding hash tables.
    • LzfEncoder

      public LzfEncoder(int totalLength, int compressThreshold)
      Creates a new LZF encoder with specified settings.
      Parameters:
      totalLength - Expected total length of content to compress; only matters for outgoing messages that is smaller than maximum chunk size (64k), to optimize encoding hash tables.
      compressThreshold - Compress threshold for LZF format. When the amount of input data is less than compressThreshold, we will construct an uncompressed output according to the LZF format.
    • LzfEncoder

      @Deprecated public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold)
      Deprecated.
      Use the constructor without the safeInstance parameter.
      Creates a new LZF encoder with specified settings.
      Parameters:
      safeInstance - If true encoder will use ChunkEncoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise encoder will try to use highly optimized ChunkEncoder implementation that uses Sun JDK's Unsafe class (which may be included by other JDK's as well).
      totalLength - Expected total length of content to compress; only matters for outgoing messages that is smaller than maximum chunk size (64k), to optimize encoding hash tables.
      compressThreshold - Compress threshold for LZF format. When the amount of input data is less than compressThreshold, we will construct an uncompressed output according to the LZF format.
  • Method Details

    • 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
    • handlerRemoved

      public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelHandlerAdapter
      Do nothing by default, sub-classes may override this method.
      Specified by:
      handlerRemoved in interface ChannelHandler
      Overrides:
      handlerRemoved 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.