public static class MessageDigestCalculatingInputStream.Builder extends ObservableInputStream.AbstractBuilder<MessageDigestCalculatingInputStream.Builder>
MessageDigestCalculatingInputStream.
For example:
MessageDigestCalculatingInputStream s = MessageDigestCalculatingInputStream.builder()
.setPath(path)
.setMessageDigest("SHA-512")
.get();
The MD5 cryptographic algorithm is weak and should not be used.
get()| Constructor and Description |
|---|
Builder()
Constructs a new builder of
MessageDigestCalculatingInputStream. |
| Modifier and Type | Method and Description |
|---|---|
org.apache.commons.io.input.MessageDigestCalculatingInputStream |
get()
Builds a new
MessageDigestCalculatingInputStream. |
void |
setMessageDigest(MessageDigest messageDigest)
Sets the message digest.
|
void |
setMessageDigest(String algorithm)
Sets the name of the name of the message digest algorithm.
|
setObserversgetAfterRead, setAfterReadgetBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplier, getUncheckedpublic Builder()
MessageDigestCalculatingInputStream.
The default for compatibility is the MD5 cryptographic algorithm which is weak and should not be used.
public org.apache.commons.io.input.MessageDigestCalculatingInputStream get()
throws IOException
MessageDigestCalculatingInputStream.
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.MessageDigestNullPointerException - if messageDigest is null.IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to an InputStream.IOException - if an I/O error occurs converting to an InputStream using AbstractStreamBuilder.getInputStream().AbstractStreamBuilder.getInputStream(),
IOSupplier.getUnchecked()public void setMessageDigest(MessageDigest messageDigest)
The MD5 cryptographic algorithm is weak and should not be used.
messageDigest - the message digest.public void setMessageDigest(String algorithm) throws 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.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified algorithm.