public static class MessageDigestCalculatingInputStream.Builder extends 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(MessageDigest messageDigest)
Sets the message digest.
|
void |
setMessageDigest(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, setBufferSizeDefault, 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 Builder()
public MessageDigestCalculatingInputStream get() throws 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.
UnsupportedOperationException - if the origin cannot provide an InputStream.IOException - if an I/O error occurs.AbstractStreamBuilder.getInputStream()public void setMessageDigest(MessageDigest messageDigest)
messageDigest - the message digest.public void setMessageDigest(String algorithm) throws 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.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.