Package com.randomnoun.common
Class ResourceFinder.HashGeneratingInputStream
java.lang.Object
java.io.InputStream
com.randomnoun.common.ResourceFinder.HashGeneratingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
ResourceFinder
An
InputStream wrapper which updates an internal md5/sha1 digest
as the stream is being read.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()getMd5()Returns the MD5 digest of all input that has been read by this InputStream so far, in a hexadecimal String formgetSha1()Returns the SHA1 digest of all input that has been read by this InputStream so far, in a hexadecimal String formvoidmark(int readlimit) booleanintread()intread(byte[] b) intread(byte[] b, int off, int len) voidreset()longskip(long n) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
HashGeneratingInputStream
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
mark
- Overrides:
markin classInputStream
-
markSupported
- Overrides:
markSupportedin classInputStream
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
getMd5
Returns the MD5 digest of all input that has been read by this InputStream so far, in a hexadecimal String form -
getSha1
Returns the SHA1 digest of all input that has been read by this InputStream so far, in a hexadecimal String form
-