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.
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.
|
getCharset, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeMax, setCharset, setCharset, setOpenOptions
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public 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.Copyright © 2010 - 2024 Adobe. All Rights Reserved