Class AbstractHashFunction.AbstractHasher
java.lang.Object
cloud.opencode.base.hash.function.AbstractHashFunction.AbstractHasher
- All Implemented Interfaces:
Hasher
- Direct Known Subclasses:
AbstractHashFunction.BufferedHasher
- Enclosing class:
AbstractHashFunction
protected abstract static class AbstractHashFunction.AbstractHasher
extends Object
implements Hasher
Abstract base class for Hasher implementations
Hasher实现的抽象基类
- Since:
- JDK 25, opencode-base-hash V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks if this hasher has been used 检查此hasher是否已被使用protected abstract HashCodedoHash()Performs the actual hash computation 执行实际的哈希计算final HashCodehash()Computes the hash value 计算哈希值putBoolean(boolean b) Adds a boolean value to the hash computation 向哈希计算添加boolean值putBytes(byte[] bytes) Adds a byte array to the hash computation 向哈希计算添加字节数组putBytes(ByteBuffer buffer) Adds a ByteBuffer to the hash computation 向哈希计算添加ByteBufferputChar(char c) Adds a char value to the hash computation 向哈希计算添加char值putDouble(double d) Adds a double value to the hash computation 向哈希计算添加double值putFloat(float f) Adds a float value to the hash computation 向哈希计算添加float值putInt(int i) Adds an int value to the hash computation 向哈希计算添加int值putLong(long l) Adds a long value to the hash computation 向哈希计算添加long值<T> HasherAdds an object using a Funnel to the hash computation 使用Funnel向哈希计算添加对象putShort(short s) Adds a short value to the hash computation 向哈希计算添加short值putString(CharSequence charSequence, Charset charset) Adds a string with specified charset to the hash computation 向哈希计算添加指定字符集的字符串
-
Constructor Details
-
AbstractHasher
protected AbstractHasher()
-
-
Method Details
-
putBytes
-
putBytes
Description copied from interface:HasherAdds a ByteBuffer to the hash computation 向哈希计算添加ByteBuffer -
putShort
-
putInt
-
putLong
-
putFloat
-
putDouble
-
putBoolean
Description copied from interface:HasherAdds a boolean value to the hash computation 向哈希计算添加boolean值- Specified by:
putBooleanin interfaceHasher- Parameters:
b- boolean value | boolean值- Returns:
- this hasher | 此hasher
-
putChar
-
putString
Description copied from interface:HasherAdds a string with specified charset to the hash computation 向哈希计算添加指定字符集的字符串 -
putObject
Description copied from interface:HasherAdds an object using a Funnel to the hash computation 使用Funnel向哈希计算添加对象 -
hash
Description copied from interface:HasherComputes the hash value 计算哈希值This method can only be called once. After calling hash(), this Hasher should not be used again.
此方法只能调用一次。调用hash()后,此Hasher不应再使用。
-
doHash
Performs the actual hash computation 执行实际的哈希计算- Returns:
- computed hash code | 计算的哈希码
-
checkNotUsed
protected void checkNotUsed()Checks if this hasher has been used 检查此hasher是否已被使用
-