Class MCRMD5InputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.security.DigestInputStream
org.mycore.common.content.streams.MCRMD5InputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Builds an MD5 checksum String while content goes through this input stream.
- Author:
- Frank Lützenkirchen
-
Field Summary
Fields inherited from class java.security.DigestInputStream
digest
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageDigest
Builds a MessageDigest instance for MD5 checksum computation.byte[]
getMD5()
Returns the MD5 message digest that has been built during reading of the underlying input stream.Returns the MD5 checksum as a Stringstatic String
getMD5String
(byte[] digest) Given an MD5 message digest, returns the MD5 checksum as a StringMethods inherited from class java.security.DigestInputStream
getMessageDigest, on, read, read, setMessageDigest, toString
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
MCRMD5InputStream
- Throws:
MCRException
-
-
Method Details
-
getMD5
public byte[] getMD5()Returns the MD5 message digest that has been built during reading of the underlying input stream.- Returns:
- the MD5 message digest checksum of all bytes that have been read
-
getMD5String
Returns the MD5 checksum as a String- Returns:
- the MD5 checksum as a String of hex digits
-
getMD5String
Given an MD5 message digest, returns the MD5 checksum as a String- Returns:
- the MD5 checksum as a String of hex digits
-
buildMD5Digest
Builds a MessageDigest instance for MD5 checksum computation.- Throws:
MCRConfigurationException
- if no java classes that support MD5 algorithm could be found
-