Class 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.

  • 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