public static class MessageDigestCalculatingInputStream.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<MessageDigestCalculatingInputStream,MessageDigestCalculatingInputStream.Builder>
MessageDigestCalculatingInputStream
instance.
For example:
MessageDigestCalculatingInputStream s = MessageDigestCalculatingInputStream.builder()
.setPath(path)
.setMessageDigest("SHA-512")
.get();
Constructor and Description |
---|
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.
|
getCharset, setBufferSize, setBufferSize, 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 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)
messageDigest
- the message digest.public void setMessageDigest(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
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 - 2023 Adobe. All Rights Reserved