private static final class Murmur3_32HashFunction.Murmur3_32Hasher extends AbstractHasher
Modifier and Type | Field and Description |
---|---|
private long |
buffer |
private int |
h1 |
private boolean |
isDone |
private int |
length |
private int |
shift |
Constructor and Description |
---|
Murmur3_32Hasher(int seed) |
Modifier and Type | Method and Description |
---|---|
HashCode |
hash()
Computes a hash code based on the data that have been provided to this hasher.
|
Hasher |
putByte(byte b)
Puts a byte into this sink.
|
Hasher |
putBytes(byte[] bytes,
int off,
int len)
Puts a chunk of an array of bytes into this sink.
|
Hasher |
putBytes(java.nio.ByteBuffer buffer)
Puts the remaining bytes of a byte buffer into this sink.
|
Hasher |
putChar(char c)
Puts a character into this sink.
|
Hasher |
putInt(int i)
Puts an int into this sink.
|
Hasher |
putLong(long l)
Puts a long into this sink.
|
Hasher |
putString(java.lang.CharSequence input,
java.nio.charset.Charset charset)
Equivalent to
putBytes(charSequence.toString().getBytes(charset)) . |
private void |
update(int nBytes,
long update) |
putBoolean, putBytes, putDouble, putFloat, putObject, putShort, putUnencodedChars
private int h1
private long buffer
private int shift
private int length
private boolean isDone
private void update(int nBytes, long update)
public Hasher putByte(byte b)
PrimitiveSink
b
- a bytepublic Hasher putBytes(byte[] bytes, int off, int len)
PrimitiveSink
bytes[off]
is the first byte written,
bytes[off + len - 1]
is the last.putBytes
in interface Hasher
putBytes
in interface PrimitiveSink
putBytes
in class AbstractHasher
bytes
- a byte arrayoff
- the start offset in the arraylen
- the number of bytes to writepublic Hasher putBytes(java.nio.ByteBuffer buffer)
PrimitiveSink
bytes.position()
is the first
byte written, bytes.limit() - 1
is the last. The position of the buffer will be equal
to the limit when this method returns.putBytes
in interface Hasher
putBytes
in interface PrimitiveSink
putBytes
in class AbstractHasher
buffer
- a byte bufferpublic Hasher putInt(int i)
PrimitiveSink
putInt
in interface Hasher
putInt
in interface PrimitiveSink
putInt
in class AbstractHasher
public Hasher putLong(long l)
PrimitiveSink
putLong
in interface Hasher
putLong
in interface PrimitiveSink
putLong
in class AbstractHasher
public Hasher putChar(char c)
PrimitiveSink
putChar
in interface Hasher
putChar
in interface PrimitiveSink
putChar
in class AbstractHasher
public Hasher putString(java.lang.CharSequence input, java.nio.charset.Charset charset)
Hasher
putBytes(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 every char
in the
input, even if some are invalid.
putString
in interface Hasher
putString
in interface PrimitiveSink
putString
in class AbstractHasher