public final class MessageDigestInputStream extends ObservableInputStream
ObservableInputStream. It creates its own ObservableInputStream.Observer,
which calculates a checksum using a MessageDigest, for example, a SHA-512 sum.
To build an instance, see MessageDigestInputStream.Builder.
See the MessageDigest section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.
You must specify a message digest algorithm name or instance.
Note: Neither ObservableInputStream, nor MessageDigest, are thread safe, so is MessageDigestInputStream.
| Modifier and Type | Class and Description |
|---|---|
static class |
MessageDigestInputStream.Builder
Builds new
MessageDigestInputStream instances. |
static class |
MessageDigestInputStream.MessageDigestMaintainingObserver
Maintains the message digest.
|
ObservableInputStream.Observer| Modifier and Type | Method and Description |
|---|---|
static MessageDigestInputStream.Builder |
builder()
Constructs a new
MessageDigestInputStream.Builder. |
java.security.MessageDigest |
getMessageDigest()
Gets the
MessageDigest, which is being used for generating the checksum. |
add, close, consume, getObservers, read, read, read, remove, removeAllObserversavailable, mark, markSupported, reset, skippublic static MessageDigestInputStream.Builder builder()
MessageDigestInputStream.Builder.MessageDigestInputStream.Builder.public java.security.MessageDigest getMessageDigest()
MessageDigest, 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().
Copyright © 2010 - 2024 Adobe. All Rights Reserved