public static class MessageDigestInputStream.Builder extends AbstractStreamBuilder<MessageDigestInputStream,MessageDigestInputStream.Builder>
MessageDigestInputStream instances.
For example:
MessageDigestInputStream s = MessageDigestInputStream.builder()
.setPath(path)
.setMessageDigest("SHA-512")
.get();
You must specify a message digest algorithm name or instance.
| Modifier and Type | Field and Description |
|---|---|
private java.security.MessageDigest |
messageDigest |
| Constructor and Description |
|---|
Builder()
Constructs a new Builder.
|
| Modifier and Type | Method and Description |
|---|---|
MessageDigestInputStream |
get()
Constructs a new instance.
|
MessageDigestInputStream.Builder |
setMessageDigest(java.security.MessageDigest messageDigest)
Sets the message digest.
|
MessageDigestInputStream.Builder |
setMessageDigest(java.lang.String algorithm)
Sets the name of the name of the message digest algorithm.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplierpublic MessageDigestInputStream get() throws java.io.IOException
This builder use the aspects InputStream, OpenOption[], and MessageDigest.
You must provide an origin that can be converted to an InputStream by this builder, otherwise, this call will throw an
UnsupportedOperationException.
java.lang.UnsupportedOperationException - if the origin cannot provide an InputStream.java.io.IOException - if an I/O error occurs.AbstractStreamBuilder.getInputStream()public MessageDigestInputStream.Builder setMessageDigest(java.security.MessageDigest messageDigest)
The MD5 cryptographic algorithm is weak and should not be used.
messageDigest - the message digest.public MessageDigestInputStream.Builder setMessageDigest(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
The MD5 cryptographic algorithm is weak and should not be used.
algorithm - the name of the algorithm. See the MessageDigest section in the
Java Cryptography
Architecture Standard Algorithm Name Documentation for information about standard algorithm names.java.security.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.