Class VanillaChunkEncoder
java.lang.Object
com.ning.compress.lzf.ChunkEncoder
com.ning.compress.lzf.impl.VanillaChunkEncoder
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Field Summary
Fields inherited from class ChunkEncoder
_encodeBuffer, _hashModulo, _hashTable, _headerBuffer, _recycler, MAX_HASH_SIZE, MAX_OFF, MAX_REF, MIN_BLOCK_TO_COMPRESS, MIN_HASH_SIZE, TAIL_LENGTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionVanillaChunkEncoder(int totalLength) protectedVanillaChunkEncoder(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) protectedVanillaChunkEncoder(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
Modifier and TypeMethodDescriptionprivate final int_handleTail(byte[] in, int inPos, int inEnd, byte[] out, int outPos, int literals) private final intfirst(byte[] in, int inPos) static VanillaChunkEncodernonAllocatingEncoder(int totalLength) static VanillaChunkEncodernonAllocatingEncoder(int totalLength, BufferRecycler bufferRecycler) protected inttryCompress(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 ChunkEncoder
appendEncodedChunk, appendEncodedIfCompresses, close, encodeAndWriteChunk, encodeAndWriteChunkIfCompresses, encodeChunk, encodeChunkIfCompresses, getBufferRecycler, hash
-
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
- Parameters:
totalLength- Total encoded length; used for calculating size of hash table to usebufferRecycler- The BufferRecycler instance
-
VanillaChunkEncoder
Alternate constructor used when we want to avoid allocation encoding buffer, in cases where caller wants full control over allocations.
-
-
Method Details
-
nonAllocatingEncoder
-
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:
tryCompressin classChunkEncoder- Returns:
- Output pointer after handling content, such that
result - originalOutPostis 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)
-