public static class MessageDigestCalculatingInputStream.Builder extends AbstractStreamBuilder<MessageDigestCalculatingInputStream,MessageDigestCalculatingInputStream.Builder>
MessageDigestCalculatingInputStream instance.
For example:
MessageDigestCalculatingInputStream s = MessageDigestCalculatingInputStream.builder()
.setPath(path)
.setMessageDigest("SHA-512")
.get();
| 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 |
|---|---|
MessageDigestCalculatingInputStream |
get()
Constructs a new instance.
|
void |
setMessageDigest(java.security.MessageDigest messageDigest)
Sets the message digest.
|
void |
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 MessageDigestCalculatingInputStream 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 void setMessageDigest(java.security.MessageDigest messageDigest)
The MD5 cryptographic algorithm is weak and should not be used.
messageDigest - the message digest.public void 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.