Package com.mastfrog.util.streams
Class HashingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.mastfrog.util.streams.HashingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Wrapper for an input stream which can compute a hash as bytes are read.
- Author:
- Tim Boudreau
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()static final MessageDigestcreateDigest(String algorithm) byte[]voidmark(int readlimit) booleanintread()intread(byte[] b, int off, int len) voidreset()static HashingInputStreamsha1(InputStream in) Methods inherited from class java.io.FilterInputStream
read, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
createDigest
-
sha1
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
getDigest
public byte[] getDigest() -
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
available
- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classFilterInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
getHashAsString
- Throws:
IOException
-