Package com.ning.compress.lzf.impl
Class VanillaChunkEncoder
- java.lang.Object
-
- com.ning.compress.lzf.ChunkEncoder
-
- com.ning.compress.lzf.impl.VanillaChunkEncoder
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class VanillaChunkEncoder extends ChunkEncoder
-
-
Field Summary
-
Fields inherited from class com.ning.compress.lzf.ChunkEncoder
_encodeBuffer, _hashModulo, _hashTable, _headerBuffer, _recycler, MAX_HASH_SIZE, MAX_OFF, MAX_REF, MIN_BLOCK_TO_COMPRESS, MIN_HASH_SIZE, TAIL_LENGTH
-
-
Constructor Summary
Constructors Modifier Constructor Description VanillaChunkEncoder(int totalLength)
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(int totalLength, BufferRecycler bufferRecycler)
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
_handleTail(byte[] in, int inPos, int inEnd, byte[] out, int outPos, int literals)
private int
first(byte[] in, int inPos)
static VanillaChunkEncoder
nonAllocatingEncoder(int totalLength)
static VanillaChunkEncoder
nonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler)
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)-
Methods inherited from class com.ning.compress.lzf.ChunkEncoder
appendEncodedChunk, appendEncodedIfCompresses, close, encodeAndWriteChunk, encodeAndWriteChunkIfCompresses, encodeChunk, encodeChunkIfCompresses, getBufferRecycler, hash
-
-
-
-
Constructor Detail
-
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 usebufferRecycler
- 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 Detail
-
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 classChunkEncoder
- 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)
-
-