Top Description Fields Constructors Methods
com.google.common.hash

pack-priv abstract Class AbstractCompositeHashFunction

extends AbstractHashFunction
Class Inheritance
Known Direct Subclasses
com.google.common.hash.Hashing.ConcatenatedHashFunction
Annotations
@Immutable
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull

An abstract composition of multiple hash functions. newHasher() delegates to the Hasher objects of the delegate hash functions, and in the end, they are used by makeHash(Hasher[]) that constructs the final HashCode.
Author
Dimitris Andreou

Field Summary

Modifier and TypeField and Description
pack-priv final HashFunction[]
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private Hasher
fromHashers(Hasher[] hashers)

pack-priv abstract HashCode
makeHash(Hasher[] hashers)

Constructs a HashCode from the Hasher objects of the functions.

public Hasher
newHasher()

Implements com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data.
public Hasher
newHasher(int expectedInputSize)

Overrides com.google.common.hash.AbstractHashFunction.newHasher.

Implements com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation as newHasher(), but provides a hint of the expected size of the input (in bytes).
Inherited from com.google.common.hash.AbstractHashFunction:
hashByteshashByteshashByteshashInthashLonghashObjecthashStringhashUnencodedChars

Field Detail

functionsback to summary
pack-priv final HashFunction[] functions
Annotations
@SuppressWarnings:Immutable
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

AbstractCompositeHashFunctionback to summary
pack-priv AbstractCompositeHashFunction(HashFunction... functions)

Method Detail

fromHashersback to summary
private Hasher fromHashers(Hasher[] hashers)
makeHashback to summary
pack-priv abstract HashCode makeHash(Hasher[] hashers)

Constructs a 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.

newHasherback to summary
public Hasher newHasher()

Implements com.google.common.hash.HashFunction.newHasher.

Doc from com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data. Example:

HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
    .putLong(id)
    .putBoolean(isActive)
    .hash();
Annotations
@Override
newHasherback to summary
public Hasher newHasher(int expectedInputSize)

Overrides com.google.common.hash.AbstractHashFunction.newHasher.

Implements com.google.common.hash.HashFunction.newHasher.

Doc from com.google.common.hash.HashFunction.newHasher.

Begins a new hash code computation as 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).

Annotations
@Override