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
In-memory stream-based implementation of Hasher.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AbstractNonStreamingHashFunction.ExposedByteArrayOutputStream -
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 bytes) Puts the remaining bytes of a byte buffer into this sink.Methods inherited from class com.google.common.hash.AbstractHasher
putBoolean, putBytes, putChar, putDouble, putFloat, putInt, putLong, putObject, putShort, putString, putUnencodedChars
-
Field Details
-
stream
-
-
Constructor Details
-
BufferingHasher
BufferingHasher(int expectedInputSize)
-
-
Method Details
-
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:
bytes- a byte buffer- Returns:
- this instance
-
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.
-