Package com.google.common.hash
Class AbstractNonStreamingHashFunction.BufferingHasher
- java.lang.Object
-
- com.google.common.hash.AbstractHasher
-
- com.google.common.hash.AbstractNonStreamingHashFunction.BufferingHasher
-
- All Implemented Interfaces:
Hasher
,PrimitiveSink
- Enclosing class:
- AbstractNonStreamingHashFunction
private final class AbstractNonStreamingHashFunction.BufferingHasher extends AbstractHasher
In-memory stream-based implementation of Hasher.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
BOTTOM_BYTE
(package private) AbstractNonStreamingHashFunction.ExposedByteArrayOutputStream
stream
-
Constructor Summary
Constructors Constructor Description BufferingHasher(int expectedInputSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
Puts an array of bytes into this sink.Hasher
putBytes(byte[] bytes, int off, int len)
Puts a chunk of an array of bytes 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.<T> Hasher
putObject(T instance, Funnel<? super T> funnel)
A simple convenience forfunnel.funnel(object, this)
.Hasher
putShort(short s)
Puts a short into this sink.-
Methods inherited from class com.google.common.hash.AbstractHasher
putBoolean, putDouble, putFloat, putString, putUnencodedChars
-
-
-
-
Field Detail
-
stream
final AbstractNonStreamingHashFunction.ExposedByteArrayOutputStream stream
-
BOTTOM_BYTE
static final int BOTTOM_BYTE
- See Also:
- Constant Field Values
-
-
Method Detail
-
putByte
public Hasher putByte(byte b)
Description copied from interface:PrimitiveSink
Puts a byte into this sink.- Parameters:
b
- a byte- Returns:
- this instance
-
putBytes
public Hasher putBytes(byte[] bytes)
Description copied from interface:PrimitiveSink
Puts an array of bytes into this sink.- Parameters:
bytes
- a byte array- Returns:
- this instance
-
putBytes
public Hasher putBytes(byte[] bytes, int off, int len)
Description copied from interface:PrimitiveSink
Puts a chunk of an array of bytes into this sink.bytes[off]
is the first byte written,bytes[off + len - 1]
is the last.- Parameters:
bytes
- a byte arrayoff
- the start offset in the arraylen
- the number of bytes to write- Returns:
- this instance
-
putShort
public Hasher putShort(short s)
Description copied from interface:PrimitiveSink
Puts a short into this sink.
-
putInt
public Hasher putInt(int i)
Description copied from interface:PrimitiveSink
Puts an int into this sink.
-
putLong
public Hasher putLong(long l)
Description copied from interface:PrimitiveSink
Puts a long into this sink.
-
putChar
public Hasher putChar(char c)
Description copied from interface:PrimitiveSink
Puts a character into this sink.
-
putObject
public <T> Hasher putObject(T instance, Funnel<? super T> funnel)
Description copied from interface:Hasher
A simple convenience forfunnel.funnel(object, this)
.
-
-