Package com.google.common.hash
Class AbstractCompositeHashFunction
- java.lang.Object
-
- com.google.common.hash.AbstractStreamingHashFunction
-
- com.google.common.hash.AbstractCompositeHashFunction
-
- All Implemented Interfaces:
HashFunction
- Direct Known Subclasses:
Hashing.ConcatenatedHashFunction
abstract class AbstractCompositeHashFunction extends AbstractStreamingHashFunction
An abstract composition of multiple hash functions. newHasher() delegates to theHasherobjects of the delegate hash functions, and in the end, they are used by makeHash(Hasher[]) that constructs the finalHashCode.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.hash.AbstractStreamingHashFunction
AbstractStreamingHashFunction.AbstractStreamingHasher
-
-
Field Summary
Fields Modifier and Type Field Description (package private) HashFunction[]functionsprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description AbstractCompositeHashFunction(HashFunction... functions)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract HashCodemakeHash(Hasher[] hashers)Constructs aHashCodefrom theHasherobjects of the functions.HashernewHasher()Begins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data.-
Methods inherited from class com.google.common.hash.AbstractStreamingHashFunction
hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.common.hash.HashFunction
bits
-
-
-
-
Field Detail
-
functions
final HashFunction[] functions
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractCompositeHashFunction
AbstractCompositeHashFunction(HashFunction... functions)
-
-
Method Detail
-
makeHash
abstract HashCode makeHash(Hasher[] hashers)
Constructs aHashCodefrom theHasherobjects of the functions. Each of them has consumed the entire input and they are ready to output aHashCode. The order of the hashers are the same order as the functions given to the constructor.
-
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();
-
-