Class AbstractHashFunction.BufferedHasher
java.lang.Object
cloud.opencode.base.hash.function.AbstractHashFunction.AbstractHasher
cloud.opencode.base.hash.function.AbstractHashFunction.BufferedHasher
- All Implemented Interfaces:
Hasher
- Enclosing class:
AbstractHashFunction
protected abstract static class AbstractHashFunction.BufferedHasher
extends AbstractHashFunction.AbstractHasher
Buffer-based hasher for accumulating bytes
基于缓冲区的hasher用于累积字节
- Since:
- JDK 25, opencode-base-hash V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidensureCapacity(int additional) Ensures buffer has enough capacity 确保缓冲区有足够容量protected byte[]getBytes()Gets accumulated bytes 获取累积的字节putByte(byte b) Adds a byte to the hash computation 向哈希计算添加一个字节putBytes(byte[] bytes, int offset, int length) Adds a portion of a byte array to the hash computation 向哈希计算添加字节数组的一部分Methods inherited from class AbstractHashFunction.AbstractHasher
checkNotUsed, doHash, hash, putBoolean, putBytes, putBytes, putChar, putDouble, putFloat, putInt, putLong, putObject, putShort, putString
-
Field Details
-
buffer
-
-
Constructor Details
-
BufferedHasher
protected BufferedHasher(int initialCapacity)
-
-
Method Details
-
putByte
-
putBytes
Description copied from interface:HasherAdds a portion of a byte array to the hash computation 向哈希计算添加字节数组的一部分- Parameters:
bytes- byte array | 字节数组offset- starting offset | 起始偏移length- number of bytes | 字节数- Returns:
- this hasher | 此hasher
-
ensureCapacity
protected void ensureCapacity(int additional) Ensures buffer has enough capacity 确保缓冲区有足够容量 -
getBytes
protected byte[] getBytes()Gets accumulated bytes 获取累积的字节
-