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 Details

  • Constructor Details

    • BufferedHasher

      protected BufferedHasher(int initialCapacity)
  • Method Details

    • putByte

      public Hasher putByte(byte b)
      Description copied from interface: Hasher
      Adds a byte to the hash computation 向哈希计算添加一个字节
      Parameters:
      b - byte value | 字节值
      Returns:
      this hasher | 此hasher
    • putBytes

      public Hasher putBytes(byte[] bytes, int offset, int length)
      Description copied from interface: Hasher
      Adds 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 获取累积的字节