Package com.google.common.hash
Class ChecksumHashFunction
- java.lang.Object
-
- com.google.common.hash.AbstractHashFunction
-
- com.google.common.hash.ChecksumHashFunction
-
- All Implemented Interfaces:
HashFunction,java.io.Serializable
final class ChecksumHashFunction extends AbstractHashFunction implements java.io.Serializable
HashFunctionadapter forChecksuminstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classChecksumHashFunction.ChecksumHasherHasher that updates a checksum.
-
Field Summary
Fields Modifier and Type Field Description private intbitsprivate ImmutableSupplier<? extends java.util.zip.Checksum>checksumSupplierprivate static longserialVersionUIDprivate java.lang.StringtoString
-
Constructor Summary
Constructors Constructor Description ChecksumHashFunction(ImmutableSupplier<? extends java.util.zip.Checksum> checksumSupplier, int bits, java.lang.String toString)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbits()Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.HashernewHasher()Begins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data.java.lang.StringtoString()-
Methods inherited from class com.google.common.hash.AbstractHashFunction
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
-
-
-
Field Detail
-
checksumSupplier
private final ImmutableSupplier<? extends java.util.zip.Checksum> checksumSupplier
-
bits
private final int bits
-
toString
private final java.lang.String toString
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChecksumHashFunction
ChecksumHashFunction(ImmutableSupplier<? extends java.util.zip.Checksum> checksumSupplier, int bits, java.lang.String toString)
-
-
Method Detail
-
bits
public int bits()
Description copied from interface:HashFunctionReturns the number of bits (a multiple of 32) that each hash code produced by this hash function has.- Specified by:
bitsin interfaceHashFunction
-
newHasher
public Hasher newHasher()
Description copied from interface:HashFunctionBegins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data. Example:HashFunction hf = Hashing.md5(); HashCode hc = hf.newHasher() .putLong(id) .putBoolean(isActive) .hash();- Specified by:
newHasherin interfaceHashFunction
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-