Package com.google.common.hash
Class Crc32cHashFunction.Crc32cHasher
- java.lang.Object
-
- com.google.common.hash.AbstractHasher
-
- com.google.common.hash.AbstractStreamingHasher
-
- com.google.common.hash.Crc32cHashFunction.Crc32cHasher
-
- All Implemented Interfaces:
Hasher,PrimitiveSink
- Enclosing class:
- Crc32cHashFunction
static final class Crc32cHashFunction.Crc32cHasher extends AbstractStreamingHasher
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int[]BYTE_TABLEprivate intcrc0private intcrc1private intcrc2private intcrc3private static java.nio.ByteBufferEMPTYprivate booleanfinished(package private) static intINVERSE_COMPUTE_FOR_WORD_OF_ALL_1S(package private) static int[][]STRIDE_TABLE
-
Constructor Summary
Constructors Constructor Description Crc32cHasher()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static intcombine(int csum, int crc)(package private) static intcomputeForWord(int word)protected HashCodemakeHash()Computes a hash code based on the data that have been provided to this hasher.protected voidprocess(java.nio.ByteBuffer bb)Processes the available bytes of the buffer (at mostchunkbytes).protected voidprocessRemaining(java.nio.ByteBuffer bb)This is invoked for the last bytes of the input, which are not enough to fill a whole chunk.-
Methods inherited from class com.google.common.hash.AbstractStreamingHasher
hash, putByte, putBytes, putBytes, putChar, putInt, putLong, putShort
-
Methods inherited from class com.google.common.hash.AbstractHasher
putBoolean, putBytes, putDouble, putFloat, putObject, putString, putUnencodedChars
-
-
-
-
Field Detail
-
finished
private boolean finished
-
crc0
private int crc0
-
crc1
private int crc1
-
crc2
private int crc2
-
crc3
private int crc3
-
BYTE_TABLE
static final int[] BYTE_TABLE
-
STRIDE_TABLE
static final int[][] STRIDE_TABLE
-
INVERSE_COMPUTE_FOR_WORD_OF_ALL_1S
static final int INVERSE_COMPUTE_FOR_WORD_OF_ALL_1S
- See Also:
- Constant Field Values
-
EMPTY
private static final java.nio.ByteBuffer EMPTY
-
-
Method Detail
-
process
protected void process(java.nio.ByteBuffer bb)
Description copied from class:AbstractStreamingHasherProcesses the available bytes of the buffer (at mostchunkbytes).- Specified by:
processin classAbstractStreamingHasher
-
processRemaining
protected void processRemaining(java.nio.ByteBuffer bb)
Description copied from class:AbstractStreamingHasherThis is invoked for the last bytes of the input, which are not enough to fill a whole chunk. The passedByteBufferis guaranteed to be non-empty.This implementation simply pads with zeros and delegates to
AbstractStreamingHasher.process(ByteBuffer).- Overrides:
processRemainingin classAbstractStreamingHasher
-
makeHash
protected HashCode makeHash()
Description copied from class:AbstractStreamingHasherComputes a hash code based on the data that have been provided to this hasher. This is called after all chunks are handled withAbstractStreamingHasher.process(java.nio.ByteBuffer)and any leftover bytes that did not make a complete chunk are handled withAbstractStreamingHasher.processRemaining(java.nio.ByteBuffer).- Specified by:
makeHashin classAbstractStreamingHasher
-
computeForWord
static int computeForWord(int word)
-
combine
static int combine(int csum, int crc)
-
-