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

pack-priv final Class ChecksumHashFunction

extends AbstractHashFunction
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@Immutable
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull

HashFunction adapter for Checksum instances.
Author
Colin Decker

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ChecksumHashFunction.ChecksumHasher

Hasher that updates a checksum.

private static class

Field Summary

Modifier and TypeField and Description
private final int
private final ImmutableSupplier<? extends Checksum>
private static final long
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
ChecksumHashFunction(ImmutableSupplier<? extends Checksum> checksumSupplier, int bits, String toString)

Method Summary

Modifier and TypeMethod and Description
public int
bits()

Implements com.google.common.hash.HashFunction.bits.

Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.
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 String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from com.google.common.hash.AbstractHashFunction:
hashByteshashByteshashByteshashInthashLonghashObjecthashStringhashUnencodedCharsnewHasher

Field Detail

bitsback to summary
private final int bits
checksumSupplierback to summary
private final ImmutableSupplier<? extends Checksum> checksumSupplier
serialVersionUIDback to summary
private static final long serialVersionUID
toStringback to summary
private final String toString

Constructor Detail

ChecksumHashFunctionback to summary
pack-priv ChecksumHashFunction(ImmutableSupplier<? extends Checksum> checksumSupplier, int bits, String toString)

Method Detail

bitsback to summary
public int bits()

Implements com.google.common.hash.HashFunction.bits.

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

Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.

Annotations
@Override
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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.google.common.hash back to summary

private final Class ChecksumHashFunction.ChecksumHasher

extends AbstractByteHasher
Class Inheritance

Hasher that updates a checksum.

Field Summary

Modifier and TypeField and Description
private final Checksum

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public HashCode
hash()

Implements com.google.common.hash.Hasher.hash.

Computes a hash code based on the data that have been provided to this hasher.
protected void
update(byte b)

Implements abstract com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with the given byte.
protected void
update(byte[] bytes, int off, int len)

Overrides com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with len bytes starting at off in the given buffer.
protected void
update(ByteBuffer b)

Overrides com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with bytes from the given buffer.
Inherited from com.google.common.hash.AbstractByteHasher:
putByteputBytesputBytesputBytesputCharputIntputLongputShortupdate

Field Detail

checksumback to summary
private final Checksum checksum

Constructor Detail

ChecksumHasherback to summary
private ChecksumHasher(Checksum checksum)

Method Detail

hashback to summary
public HashCode hash()

Implements com.google.common.hash.Hasher.hash.

Doc from com.google.common.hash.Hasher.hash.

Computes a hash code based on the data that have been provided to this hasher. The result is unspecified if this method is called more than once on the same instance.

Annotations
@Override
updateback to summary
protected void update(byte b)

Implements abstract com.google.common.hash.AbstractByteHasher.update.

Doc from com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with the given byte.

Annotations
@Override
updateback to summary
protected void update(byte[] bytes, int off, int len)

Overrides com.google.common.hash.AbstractByteHasher.update.

Doc from com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with len bytes starting at off in the given buffer.

Annotations
@Override
updateback to summary
protected void update(ByteBuffer b)

Overrides com.google.common.hash.AbstractByteHasher.update.

Doc from com.google.common.hash.AbstractByteHasher.update.

Updates this hasher with bytes from the given buffer.

Annotations
@Override
@J2ObjCIncompatible
com.google.common.hash back to summary

private final Class ChecksumHashFunction.ChecksumMethodHandles

extends Object
Class Inheritance
  • java.lang.Object
  • com.google.common.hash.ChecksumHashFunction.ChecksumMethodHandles
Annotations
@J2ObjCIncompatible
@SuppressWarnings:unused

Field Summary

Modifier and TypeField and Description
private static final @Nullable MethodHandle

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static LinkageError
pack-priv static boolean
private static @Nullable MethodHandle
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

UPDATE_BBback to summary
private static final @Nullable MethodHandle UPDATE_BB

Constructor Detail

ChecksumMethodHandlesback to summary
private ChecksumMethodHandles()

Method Detail

newLinkageErrorback to summary
private static LinkageError newLinkageError(Throwable cause)
updateByteBufferback to summary
pack-priv static boolean updateByteBuffer(Checksum cs, ByteBuffer bb)
Annotations
@IgnoreJRERequirement
updateByteBufferback to summary
private static @Nullable MethodHandle updateByteBuffer()