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
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int[]
private int
private int
private int
private int
private static final ByteBuffer
private boolean
(package private) static final int
(package private) static final int[][]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(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
(ByteBuffer bb) Processes the available bytes of the buffer (at mostchunk
bytes).protected void
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 Details
-
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:
-
EMPTY
-
-
Constructor Details
-
Crc32cHasher
Crc32cHasher()
-
-
Method Details
-
process
Description copied from class:AbstractStreamingHasher
Processes the available bytes of the buffer (at mostchunk
bytes).- Specified by:
process
in classAbstractStreamingHasher
-
processRemaining
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
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)
-