Class MessageDigestCalculatingInputStream
- All Implemented Interfaces:
- Closeable,- AutoCloseable
MessageDigest, for example, a SHA-512 sum.
 
 To build an instance, use MessageDigestCalculatingInputStream.Builder.
 
See the MessageDigest section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.
 Note: Neither ObservableInputStream, nor MessageDigest, are thread safe, so is MessageDigestCalculatingInputStream.
 
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Builds a newMessageDigestCalculatingInputStream.static classDeprecated.Maintains the message digest.Nested classes/interfaces inherited from class org.apache.commons.io.input.ObservableInputStreamObservableInputStream.AbstractBuilder<T extends ObservableInputStream.AbstractBuilder<T>>, ObservableInputStream.Observer
- 
Field SummaryFields inherited from class java.io.FilterInputStreamin
- 
Constructor SummaryConstructorsConstructorDescriptionMessageDigestCalculatingInputStream(InputStream inputStream) MessageDigestCalculatingInputStream(InputStream inputStream, String algorithm) MessageDigestCalculatingInputStream(InputStream inputStream, MessageDigest messageDigest) 
- 
Method SummaryModifier and TypeMethodDescriptionbuilder()Deprecated.Constructs a newMessageDigestCalculatingInputStream.Builder.Deprecated.Gets theMessageDigest, which is being used for generating the checksum.Methods inherited from class org.apache.commons.io.input.ObservableInputStreamadd, close, consume, getObservers, noteClosed, noteDataByte, noteDataBytes, noteError, noteFinished, read, read, read, remove, removeAllObserversMethods inherited from class org.apache.commons.io.input.ProxyInputStreamafterRead, available, beforeRead, handleIOException, mark, markSupported, reset, setReference, skip, unwrap
- 
Constructor Details- 
MessageDigestCalculatingInputStream@Deprecated public MessageDigestCalculatingInputStream(InputStream inputStream) throws NoSuchAlgorithmException Deprecated.Constructs a new instance, which calculates a signature on the given stream, using aMessageDigestwith the "MD5" algorithm.The MD5 algorithm is weak and should not be used. - Parameters:
- inputStream- the stream to calculate the message digest for
- Throws:
- NoSuchAlgorithmException- if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
 
- 
MessageDigestCalculatingInputStream@Deprecated public MessageDigestCalculatingInputStream(InputStream inputStream, MessageDigest messageDigest) Deprecated.Constructs a new instance, which calculates a signature on the given stream, using the givenMessageDigest.The MD5 cryptographic algorithm is weak and should not be used. - Parameters:
- inputStream- the stream to calculate the message digest for
- messageDigest- the message digest to use
- Throws:
- NullPointerException- if messageDigest is null.
 
- 
MessageDigestCalculatingInputStream@Deprecated public MessageDigestCalculatingInputStream(InputStream inputStream, String algorithm) throws NoSuchAlgorithmException Deprecated.Constructs a new instance, which calculates a signature on the given stream, using aMessageDigestwith the given algorithm.The MD5 cryptographic algorithm is weak and should not be used. - Parameters:
- inputStream- the stream to calculate the message digest for
- algorithm- the name of the algorithm requested. See the MessageDigest section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.
- Throws:
- NoSuchAlgorithmException- if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
 
 
- 
- 
Method Details- 
builderDeprecated.Constructs a newMessageDigestCalculatingInputStream.Builder.- Returns:
- a new MessageDigestCalculatingInputStream.Builder.
- Since:
- 2.12.0
 
- 
getMessageDigestDeprecated.Gets theMessageDigest, which is being used for generating the checksum.Note: The checksum will only reflect the data, which has been read so far. This is probably not, what you expect. Make sure, that the complete data has been read, if that is what you want. The easiest way to do so is by invoking ObservableInputStream.consume().- Returns:
- the message digest used
 
 
- 
MessageDigestInputStream.