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_TABLE
private int
crc0
private int
crc1
private int
crc2
private int
crc3
private static java.nio.ByteBuffer
EMPTY
private boolean
finished
(package private) static int
INVERSE_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 int
combine(int csum, int crc)
(package private) static int
computeForWord(int word)
protected HashCode
makeHash()
Computes a hash code based on the data that have been provided to this hasher.protected void
process(java.nio.ByteBuffer bb)
Processes the available bytes of the buffer (at mostchunk
bytes).protected void
processRemaining(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:AbstractStreamingHasher
Processes the available bytes of the buffer (at mostchunk
bytes).- Specified by:
process
in classAbstractStreamingHasher
-
processRemaining
protected void processRemaining(java.nio.ByteBuffer bb)
Description copied from class:AbstractStreamingHasher
This is invoked for the last bytes of the input, which are not enough to fill a whole chunk. The passedByteBuffer
is guaranteed to be non-empty.This implementation simply pads with zeros and delegates to
AbstractStreamingHasher.process(ByteBuffer)
.- Overrides:
processRemaining
in classAbstractStreamingHasher
-
makeHash
protected HashCode makeHash()
Description copied from class:AbstractStreamingHasher
Computes 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:
makeHash
in classAbstractStreamingHasher
-
computeForWord
static int computeForWord(int word)
-
combine
static int combine(int csum, int crc)
-
-