public abstract class AdvancedStreamingHasher extends AbstractStreamingHasher
Hasher; handles accumulating data until an
entire "chunk" (of implementation-dependent length) is ready to be hashed.seed| 限定符 | 构造器和说明 |
|---|---|
protected |
AdvancedStreamingHasher(int chunkSize)
Constructor for use by subclasses.
|
protected |
AdvancedStreamingHasher(int chunkSize,
int bufferSize)
Constructor for use by subclasses.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected long |
doFinal() |
long |
getHash() |
protected abstract long |
makeHash()
Computes a hash code based on the data that have been provided to this hasher.
|
protected abstract void |
process(ByteBuffer bb)
Processes the available bytes of the buffer (at most
chunk bytes). |
protected void |
processRemaining(ByteBuffer bb)
This is invoked for the last bytes of the input, which are not enough to fill a whole chunk.
|
protected AdvancedStreamingHasher |
putBytes(byte[] bytes,
int off,
int len) |
void |
update(byte[] bytes,
int off,
int len)
用于流式计算
|
asInt, asLong, hash, padToLong, reset, toLong, updatecreateInstance, get, getName, hash, hash, setSeedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetSeedprotected AdvancedStreamingHasher(int chunkSize)
chunkSize - the number of bytes available per process(ByteBuffer) invocation;
must be at least 4protected AdvancedStreamingHasher(int chunkSize,
int bufferSize)
bufferSize size, which must be a multiple of
chunkSize.chunkSize - the number of bytes available per process(ByteBuffer) invocation;
must be at least 4bufferSize - the size of the internal buffer. Must be a multiple of chunkSizeprotected abstract void process(ByteBuffer bb)
chunk bytes).protected void processRemaining(ByteBuffer bb)
ByteBuffer is guaranteed to be non-empty.
This implementation simply pads with zeros and delegates to process(ByteBuffer).
public void update(byte[] bytes,
int off,
int len)
AbstractStreamingHasherupdate 在接口中 StreamingHasherupdate 在类中 AbstractStreamingHasherpublic long getHash()
protected final AdvancedStreamingHasher putBytes(byte[] bytes, int off, int len)
protected final long doFinal()
protected abstract long makeHash()
process(java.nio.ByteBuffer) and any leftover bytes that did not make
a complete chunk are handled with processRemaining(java.nio.ByteBuffer).Copyright © 2022. All rights reserved.