abstract class AbstractCompositeHashFunction extends AbstractHashFunction
Hasher objects of the delegate hash functions, and in the end, they are used by
makeHash(Hasher[]) that constructs the final HashCode.| Modifier and Type | Field and Description |
|---|---|
(package private) HashFunction[] |
functions |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
AbstractCompositeHashFunction(HashFunction... functions) |
| Modifier and Type | Method and Description |
|---|---|
private Hasher |
fromHashers(Hasher[] hashers) |
(package private) abstract HashCode |
makeHash(Hasher[] hashers)
Constructs a
HashCode from the Hasher objects of the functions. |
Hasher |
newHasher()
Begins a new hash code computation by returning an initialized, stateful
Hasher
instance that is ready to receive data. |
Hasher |
newHasher(int expectedInputSize)
Begins a new hash code computation as
HashFunction.newHasher(), but provides a hint of the expected
size of the input (in bytes). |
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedCharsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbitsfinal HashFunction[] functions
private static final long serialVersionUID
AbstractCompositeHashFunction(HashFunction... functions)
abstract HashCode makeHash(Hasher[] hashers)
HashCode from the Hasher objects of the functions. Each of them
has consumed the entire input and they are ready to output a HashCode. The order of the
hashers are the same order as the functions given to the constructor.public Hasher newHasher()
HashFunctionHasher
instance that is ready to receive data. Example:
HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
.putLong(id)
.putBoolean(isActive)
.hash();
public Hasher newHasher(int expectedInputSize)
HashFunctionHashFunction.newHasher(), but provides a hint of the expected
size of the input (in bytes). This is only important for non-streaming hash functions (hash
functions that need to buffer their whole input before processing any of it).newHasher in interface HashFunctionnewHasher in class AbstractHashFunction