HashFunction, appropriate for non-streaming algorithms. All
the hash computation done using newHasher() are delegated to the hashBytes(byte[], int, int) method.
| Modifier and Type | Class and Description |
|---|---|
| private class | AbstractNonStreamingHashFunction.BufferingHasher
In-memory stream-based implementation of Hasher. |
| private static class |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public abstract HashCode | hashBytes(byte[] input, int off, int len)
Redeclares com. Overrides com. newHasher().putBytes(input, off, len).hash().
|
| public HashCode | hashBytes(ByteBuffer input)
Overrides com. Implements com. newHasher().putBytes(input).hash().
|
| public HashCode | hashInt(int input)
Overrides com. Implements com. newHasher().putInt(input).hash(); returns the hash code for the given
int value, interpreted in little-endian byte order.
|
| public HashCode | hashLong(long input)
Overrides com. Implements com. newHasher().putLong(input).hash(); returns the hash code for the given
long value, interpreted in little-endian byte order.
|
| public HashCode | hashString(CharSequence input, Charset charset)
Overrides com. Implements com. newHasher().putString(input, charset).hash().
|
| public HashCode | hashUnencodedChars(CharSequence input)
Overrides com. Implements com. newHasher().putUnencodedChars(input).hash().
|
| public Hasher | newHasher()
Implements com. Hasher
instance that is ready to receive data.
|
| public Hasher | newHasher(int expectedInputSize)
Overrides com. Implements com. newHasher(), but provides a hint of the expected
size of the input (in bytes).
|
| AbstractNonStreamingHashFunction | back to summary |
|---|---|
| pack-priv AbstractNonStreamingHashFunction() | |
| hashBytes | back to summary |
|---|---|
| public abstract HashCode hashBytes(byte[] input, int off, int len) Redeclares com. Overrides com. Doc from com. Shortcut for
| |
| hashBytes | back to summary |
|---|---|
| public HashCode hashBytes(ByteBuffer input) Overrides com. Implements com. Doc from com. Shortcut for
| |
| hashInt | back to summary |
|---|---|
| public HashCode hashInt(int input) Overrides com. Implements com. Doc from com. Shortcut for
| |
| hashLong | back to summary |
|---|---|
| public HashCode hashLong(long input) Overrides com. Implements com. Doc from com. Shortcut for
| |
| hashString | back to summary |
|---|---|
| public HashCode hashString(CharSequence input, Charset charset) Overrides com. Implements com. Doc from com. Shortcut for Warning This method, which reencodes the input before hashing it, is useful only for
cross-language compatibility. For other use cases, prefer
| |
| hashUnencodedChars | back to summary |
|---|---|
| public HashCode hashUnencodedChars(CharSequence input) Overrides com. Implements com. Doc from com. Shortcut for Warning This method will produce different output than most other languages do when
running the same hash function on the equivalent input. For cross-language compatibility, use
| |
| newHasher | back to summary |
|---|---|
| public Hasher newHasher() Implements com. Doc from com. Begins a new hash code computation by returning an initialized, stateful
| |
| newHasher | back to summary |
|---|---|
| public Hasher newHasher(int expectedInputSize) Overrides com. Implements com. Doc from com. Begins a new hash code computation as
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AbstractNonStreamingHashFunction. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public HashCode | hash()
Implements com. |
| public Hasher | |
| public Hasher | putBytes(byte[]
a byte array bytes, int the start offset in the array off, int the number of bytes to write len)Overrides com. Implements com. |
| public Hasher | putBytes(ByteBuffer
a byte buffer bytes)Overrides com. Implements com. |
| stream | back to summary |
|---|---|
| pack-priv final AbstractNonStreamingHashFunction. | |
| BufferingHasher | back to summary |
|---|---|
| pack-priv BufferingHasher(int expectedInputSize) | |
| hash | back to summary |
|---|---|
| public HashCode hash() Implements com. Doc from com. 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.
| |
| putByte | back to summary |
|---|---|
| public Hasher putByte(byte b) Implements com. Doc from com. Puts a byte into this sink. | |
| putBytes | back to summary |
|---|---|
| public Hasher putBytes(byte[] bytes, int off, int len) Overrides com. Implements com. Doc from com. Puts a chunk of an array of bytes into this sink. | |
| putBytes | back to summary |
|---|---|
| public Hasher putBytes(ByteBuffer bytes) Overrides com. Implements com. Doc from com. Puts the remaining bytes of a byte buffer into this sink.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv byte[] | |
| pack-priv int | |
| pack-priv void |
| ExposedByteArrayOutputStream | back to summary |
|---|---|
| pack-priv ExposedByteArrayOutputStream(int expectedInputSize) | |
| byteArray | back to summary |
|---|---|
| pack-priv byte[] byteArray() | |
| length | back to summary |
|---|---|
| pack-priv int length() | |
| write | back to summary |
|---|---|
| pack-priv void write(ByteBuffer input) | |