Class VanillaChunkEncoder

java.lang.Object
com.ning.compress.lzf.ChunkEncoder
com.ning.compress.lzf.impl.VanillaChunkEncoder
All Implemented Interfaces:
Closeable, AutoCloseable

public class VanillaChunkEncoder extends ChunkEncoder
  • Constructor Details

    • VanillaChunkEncoder

      public VanillaChunkEncoder(int totalLength)
      Parameters:
      totalLength - Total encoded length; used for calculating size of hash table to use
    • VanillaChunkEncoder

      protected VanillaChunkEncoder(int totalLength, boolean bogus)
      Alternate constructor used when we want to avoid allocation encoding buffer, in cases where caller wants full control over allocations.
    • VanillaChunkEncoder

      public VanillaChunkEncoder(int totalLength, BufferRecycler bufferRecycler)
      Parameters:
      totalLength - Total encoded length; used for calculating size of hash table to use
      bufferRecycler - The BufferRecycler instance
    • VanillaChunkEncoder

      protected VanillaChunkEncoder(int totalLength, BufferRecycler bufferRecycler, boolean bogus)
      Alternate constructor used when we want to avoid allocation encoding buffer, in cases where caller wants full control over allocations.
  • Method Details

    • nonAllocatingEncoder

      public static VanillaChunkEncoder nonAllocatingEncoder(int totalLength)
    • nonAllocatingEncoder

      public static VanillaChunkEncoder nonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler)
    • tryCompress

      protected int tryCompress(byte[] in, int inPos, int inEnd, byte[] out, int outPos)
      Main workhorse method that will try to compress given chunk, and return end position (offset to byte after last included byte)
      Specified by:
      tryCompress in class ChunkEncoder
      Returns:
      Output pointer after handling content, such that result - originalOutPost is the actual length of compressed chunk (without header)
    • _handleTail

      private final int _handleTail(byte[] in, int inPos, int inEnd, byte[] out, int outPos, int literals)
    • first

      private final int first(byte[] in, int inPos)