Package org.iq80.snappy
Class SnappyCompressor
- java.lang.Object
-
- org.iq80.snappy.SnappyCompressor
-
final class SnappyCompressor extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BLOCK_LOG
private static int
BLOCK_SIZE
private static int
INPUT_MARGIN_BYTES
private static int
MAX_HASH_TABLE_BITS
private static int
MAX_HASH_TABLE_SIZE
private static boolean
NATIVE_LITTLE_ENDIAN
-
Constructor Summary
Constructors Constructor Description SnappyCompressor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
bytesBetweenHashLookups(int skip)
static int
compress(byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset)
private static int
compressFragment(byte[] input, int inputOffset, int inputSize, byte[] output, int outputIndex, short[] table)
private static int[]
emitCopies(byte[] input, int inputOffset, int inputSize, int ipIndex, byte[] output, int outputIndex, short[] table, int shift, int candidateIndex)
private static int
emitCopy(byte[] output, int outputIndex, int offset, int length)
private static int
emitCopyLessThan64(byte[] output, int outputIndex, int offset, int length)
private static int
emitLiteral(byte[] output, int outputIndex, byte[] literal, int literalIndex, int length, boolean allowFastPath)
private static int[]
findCandidate(byte[] input, int ipIndex, int ipLimit, int inputOffset, int shift, short[] table, int skip)
private static int
findMatchLength(byte[] s1, int s1Index, byte[] s2, int s2Index, int s2Limit)
private static int
getHashTableSize(int inputSize)
private static int
hashBytes(int bytes, int shift)
private static int
log2Floor(int n)
static int
maxCompressedLength(int sourceLength)
private static int
writeUncompressedLength(byte[] compressed, int compressedOffset, int uncompressedLength)
Writes the uncompressed length as variable length integer.
-
-
-
Field Detail
-
NATIVE_LITTLE_ENDIAN
private static final boolean NATIVE_LITTLE_ENDIAN
-
BLOCK_LOG
private static final int BLOCK_LOG
- See Also:
- Constant Field Values
-
BLOCK_SIZE
private static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
INPUT_MARGIN_BYTES
private static final int INPUT_MARGIN_BYTES
- See Also:
- Constant Field Values
-
MAX_HASH_TABLE_BITS
private static final int MAX_HASH_TABLE_BITS
- See Also:
- Constant Field Values
-
MAX_HASH_TABLE_SIZE
private static final int MAX_HASH_TABLE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
maxCompressedLength
public static int maxCompressedLength(int sourceLength)
-
compress
public static int compress(byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset)
-
compressFragment
private static int compressFragment(byte[] input, int inputOffset, int inputSize, byte[] output, int outputIndex, short[] table)
-
findCandidate
private static int[] findCandidate(byte[] input, int ipIndex, int ipLimit, int inputOffset, int shift, short[] table, int skip)
-
bytesBetweenHashLookups
private static int bytesBetweenHashLookups(int skip)
-
emitCopies
private static int[] emitCopies(byte[] input, int inputOffset, int inputSize, int ipIndex, byte[] output, int outputIndex, short[] table, int shift, int candidateIndex)
-
emitLiteral
private static int emitLiteral(byte[] output, int outputIndex, byte[] literal, int literalIndex, int length, boolean allowFastPath)
-
emitCopyLessThan64
private static int emitCopyLessThan64(byte[] output, int outputIndex, int offset, int length)
-
emitCopy
private static int emitCopy(byte[] output, int outputIndex, int offset, int length)
-
findMatchLength
private static int findMatchLength(byte[] s1, int s1Index, byte[] s2, int s2Index, int s2Limit)
-
getHashTableSize
private static int getHashTableSize(int inputSize)
-
hashBytes
private static int hashBytes(int bytes, int shift)
-
log2Floor
private static int log2Floor(int n)
-
writeUncompressedLength
private static int writeUncompressedLength(byte[] compressed, int compressedOffset, int uncompressedLength)
Writes the uncompressed length as variable length integer.
-
-