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 TypeMethodDescriptionint
void
close()
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 formvoid
mark
(int readlimit) boolean
int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) void
reset()
long
skip
(long n) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
HashGeneratingInputStream
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-
mark
- Overrides:
mark
in classInputStream
-
markSupported
- Overrides:
markSupported
in classInputStream
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in 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
-