@Beta public final class HashingInputStream extends java.io.FilterInputStream
InputStream that maintains a hash of the data read from it.| Constructor and Description |
|---|
HashingInputStream(HashFunction hashFunction,
java.io.InputStream in)
Creates an input stream that hashes using the given
HashFunction and delegates all data
read from it to the underlying InputStream. |
| Modifier and Type | Method and Description |
|---|---|
HashCode |
hash()
Returns the
HashCode based on the data read from this stream. |
void |
mark(int readlimit)
mark() is not supported for HashingInputStream
|
boolean |
markSupported()
mark() is not supported for HashingInputStream
|
int |
read()
Reads the next byte of data from the underlying input stream and updates the hasher with
the byte read.
|
int |
read(byte[] bytes,
int off,
int len)
Reads the specified bytes of data from the underlying input stream and updates the hasher with
the bytes read.
|
void |
reset()
reset() is not supported for HashingInputStream.
|
public HashingInputStream(HashFunction hashFunction, java.io.InputStream in)
HashFunction and delegates all data
read from it to the underlying InputStream.
The InputStream should not be read from before or after the hand-off.
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] bytes,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException@CheckReturnValue public boolean markSupported()
markSupported in class java.io.FilterInputStreamfalse alwayspublic void mark(int readlimit)
mark in class java.io.FilterInputStreampublic void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOException - this operation is not supported