public class MultiHasher
extends java.lang.Object
HashCodes from an input.
Created by covers1624 on 15/2/21.
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiHasher.HashFunc
Represents a HashFunction.
|
static class |
MultiHasher.HashResult
Represents a completed result from this
MultiHasher. |
| Constructor and Description |
|---|
MultiHasher(java.util.Collection<MultiHasher.HashFunc> hashFunctions) |
MultiHasher(MultiHasher.HashFunc... hashFunctions) |
| Modifier and Type | Method and Description |
|---|---|
MultiHasher.HashResult |
finish()
Finishes this
MultiHasher, returning a MultiHasher.HashResult result. |
void |
load(java.io.InputStream is)
Loads the content of the given
InputStream into the MultiHasher. |
void |
load(java.nio.file.Path path)
Loads the content of the provided Path into the
MultiHasher. |
void |
update(byte[] bytes)
Appends the given bytes to the
MultiHasher. |
void |
update(byte[] bytes,
int offset,
int len)
Appends the specified bytes at the offset with the given length to the
MultiHasher. |
public MultiHasher(MultiHasher.HashFunc... hashFunctions)
public MultiHasher(java.util.Collection<MultiHasher.HashFunc> hashFunctions)
public MultiHasher.HashResult finish()
MultiHasher, returning a MultiHasher.HashResult result.
It is invalid to update a MultiHasher after it has finished.
java.lang.IllegalStateException - When this MultiHasher has already been finished.public void load(java.nio.file.Path path)
throws java.io.IOException
MultiHasher.path - The path to load.java.io.IOException - If there was an error reading/opening the file.public void load(java.io.InputStream is)
throws java.io.IOException
InputStream into the MultiHasher.
This method will block until there is no more data in the stream.
is - The InputStream to read from.java.io.IOException - If there was an error reading from the streampublic void update(byte[] bytes)
MultiHasher.bytes - The Bytes to append.public void update(byte[] bytes,
int offset,
int len)
MultiHasher.bytes - The bytes to add from.offset - The offset into the buffer.len - The length of the bytes to add.