final class ChecksumHashFunction extends AbstractStreamingHashFunction implements java.io.Serializable
HashFunction adapter for Checksum instances.| Modifier and Type | Class and Description |
|---|---|
private class |
ChecksumHashFunction.ChecksumHasher
Hasher that updates a checksum.
|
AbstractStreamingHashFunction.AbstractStreamingHasher| Modifier and Type | Field and Description |
|---|---|
private int |
bits |
private Supplier<? extends java.util.zip.Checksum> |
checksumSupplier |
private static long |
serialVersionUID |
private java.lang.String |
toString |
| Constructor and Description |
|---|
ChecksumHashFunction(Supplier<? extends java.util.zip.Checksum> checksumSupplier,
int bits,
java.lang.String toString) |
| Modifier and Type | Method and Description |
|---|---|
int |
bits()
Returns the number of bits (a multiple of 32) that each hash code produced by this hash
function has.
|
Hasher |
newHasher()
Begins a new hash code computation by returning an initialized, stateful
Hasher instance that is ready to receive data. |
java.lang.String |
toString() |
hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasherprivate final Supplier<? extends java.util.zip.Checksum> checksumSupplier
private final int bits
private final java.lang.String toString
private static final long serialVersionUID
ChecksumHashFunction(Supplier<? extends java.util.zip.Checksum> checksumSupplier, int bits, java.lang.String toString)
public int bits()
HashFunctionbits in interface HashFunctionpublic Hasher newHasher()
HashFunctionHasher instance that is ready to receive data. Example:
HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
.putLong(id)
.putBoolean(isActive)
.hash();newHasher in interface HashFunctionpublic java.lang.String toString()
toString in class java.lang.Object