public static class MessageDigestInputStream.Builder extends ObservableInputStream.AbstractBuilder<MessageDigestInputStream.Builder>
MessageDigestInputStream.
For example:
MessageDigestInputStream s = MessageDigestInputStream.builder()
.setPath(path)
.setMessageDigest("SHA-512")
.get();
You must specify a message digest algorithm name or instance.
The MD5 cryptographic algorithm is weak and should not be used.
get()| Constructor and Description |
|---|
Builder()
Constructs a new builder of
MessageDigestInputStream. |
| Modifier and Type | Method and Description |
|---|---|
MessageDigestInputStream |
get()
Builds new
MessageDigestInputStream. |
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.
|
setObserversgetBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeMax, setCharset, setCharset, setOpenOptionssetByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriterequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplier, getUncheckedpublic Builder()
MessageDigestInputStream.public MessageDigestInputStream get() throws java.io.IOException
MessageDigestInputStream.
You must set an aspect that supports AbstractStreamBuilder.getInputStream(), otherwise, this method throws an exception.
This builder uses the following aspects:
AbstractStreamBuilder.getInputStream() gets the target aspect.MessageDigestjava.lang.NullPointerException - if messageDigest is null.java.lang.IllegalStateException - if the origin is null.java.lang.UnsupportedOperationException - if the origin cannot be converted to an InputStream.java.io.IOException - if an I/O error occurs converting to an InputStream using AbstractStreamBuilder.getInputStream().AbstractStreamBuilder.getInputStream(),
IOSupplier.getUnchecked()public MessageDigestInputStream.Builder setMessageDigest(java.security.MessageDigest messageDigest)
The MD5 cryptographic algorithm is weak and should not be used.
messageDigest - the message digest.this instance.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.this instance.java.security.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.Copyright © 2010 - 2025 Adobe. All Rights Reserved