@Beta public final class HashingInputStream extends FilterInputStream
InputStream that maintains a hash of the data read from it.in| Constructor and Description |
|---|
HashingInputStream(HashFunction hashFunction,
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.
|
available, close, read, skippublic HashingInputStream(HashFunction hashFunction, 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 IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] bytes, int off, int len) throws IOException
read in class FilterInputStreamIOExceptionpublic boolean markSupported()
markSupported in class FilterInputStreamfalse alwayspublic void mark(int readlimit)
mark in class FilterInputStreampublic void reset() throws IOException
reset in class FilterInputStreamIOException - this operation is not supportedCopyright © 2010–2017. All rights reserved.