Package com.google.common.hash
Class ChecksumHashFunction
java.lang.Object
com.google.common.hash.AbstractHashFunction
com.google.common.hash.ChecksumHashFunction
- All Implemented Interfaces:
HashFunction
,Serializable
HashFunction
adapter for Checksum
instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
Hasher that updates a checksum.private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final ImmutableSupplier
<? extends Checksum> private static final long
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionChecksumHashFunction
(ImmutableSupplier<? extends Checksum> checksumSupplier, int bits, String toString) -
Method Summary
Methods inherited from class com.google.common.hash.AbstractHashFunction
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
Field Details
-
checksumSupplier
-
bits
private final int bits -
toString
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ChecksumHashFunction
ChecksumHashFunction(ImmutableSupplier<? extends Checksum> checksumSupplier, int bits, String toString)
-
-
Method Details
-
bits
public int bits()Description copied from interface:HashFunction
Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.- Specified by:
bits
in interfaceHashFunction
-
newHasher
Description copied from interface:HashFunction
Begins a new hash code computation by returning an initialized, statefulHasher
instance that is ready to receive data. Example:HashFunction hf = Hashing.md5(); HashCode hc = hf.newHasher() .putLong(id) .putBoolean(isActive) .hash();
- Specified by:
newHasher
in interfaceHashFunction
-
toString
-