Package com.google.common.hash
Class Murmur3_32HashFunction.Murmur3_32Hasher
java.lang.Object
com.google.common.hash.AbstractHasher
com.google.common.hash.Murmur3_32HashFunction.Murmur3_32Hasher
- All Implemented Interfaces:
Hasher,PrimitiveSink
- Enclosing class:
- Murmur3_32HashFunction
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhash()Computes a hash code based on the data that have been provided to this hasher.putByte(byte b) Puts a byte into this sink.putBytes(byte[] bytes, int off, int len) Puts a chunk of an array of bytes into this sink.putBytes(ByteBuffer buffer) Puts the remaining bytes of a byte buffer into this sink.putChar(char c) Puts a character into this sink.putInt(int i) Puts an int into this sink.putLong(long l) Puts a long into this sink.putString(CharSequence input, Charset charset) Equivalent toputBytes(charSequence.toString().getBytes(charset)).private voidupdate(int nBytes, long update) Methods inherited from class com.google.common.hash.AbstractHasher
putBoolean, putBytes, putDouble, putFloat, putObject, putShort, putUnencodedChars
-
Field Details
-
h1
private int h1 -
buffer
private long buffer -
shift
private int shift -
length
private int length -
isDone
private boolean isDone
-
-
Constructor Details
-
Murmur3_32Hasher
Murmur3_32Hasher(int seed)
-
-
Method Details
-
update
private void update(int nBytes, long update) -
putByte
Description copied from interface:PrimitiveSinkPuts a byte into this sink.- Parameters:
b- a byte- Returns:
- this instance
-
putBytes
Description copied from interface:PrimitiveSinkPuts a chunk of an array of bytes into this sink.bytes[off]is the first byte written,bytes[off + len - 1]is the last.- Specified by:
putBytesin interfaceHasher- Specified by:
putBytesin interfacePrimitiveSink- Overrides:
putBytesin classAbstractHasher- Parameters:
bytes- a byte arrayoff- the start offset in the arraylen- the number of bytes to write- Returns:
- this instance
-
putBytes
Description copied from interface:PrimitiveSinkPuts the remaining bytes of a byte buffer into this sink.bytes.position()is the first byte written,bytes.limit() - 1is the last. The position of the buffer will be equal to the limit when this method returns.- Specified by:
putBytesin interfaceHasher- Specified by:
putBytesin interfacePrimitiveSink- Overrides:
putBytesin classAbstractHasher- Parameters:
buffer- a byte buffer- Returns:
- this instance
-
putInt
Description copied from interface:PrimitiveSinkPuts an int into this sink.- Specified by:
putIntin interfaceHasher- Specified by:
putIntin interfacePrimitiveSink- Overrides:
putIntin classAbstractHasher
-
putLong
Description copied from interface:PrimitiveSinkPuts a long into this sink.- Specified by:
putLongin interfaceHasher- Specified by:
putLongin interfacePrimitiveSink- Overrides:
putLongin classAbstractHasher
-
putChar
Description copied from interface:PrimitiveSinkPuts a character into this sink.- Specified by:
putCharin interfaceHasher- Specified by:
putCharin interfacePrimitiveSink- Overrides:
putCharin classAbstractHasher
-
putString
Description copied from interface:HasherEquivalent toputBytes(charSequence.toString().getBytes(charset)).Warning: This method, which reencodes the input before hashing it, is useful only for cross-language compatibility. For other use cases, prefer
Hasher.putUnencodedChars(java.lang.CharSequence), which is faster, produces the same output across Java releases, and hashes everycharin the input, even if some are invalid.- Specified by:
putStringin interfaceHasher- Specified by:
putStringin interfacePrimitiveSink- Overrides:
putStringin classAbstractHasher
-
hash
Description copied from interface:HasherComputes a hash code based on the data that have been provided to this hasher. The result is unspecified if this method is called more than once on the same instance.
-