java.security
public class DigestInputStream extends FilterInputStream
Field Summary | |
---|---|
protected MessageDigest | digest
The message digest for the DigestInputStream |
Constructor Summary | |
---|---|
DigestInputStream(InputStream stream, MessageDigest digest)
Constructs a new DigestInputStream.
|
Method Summary | |
---|---|
MessageDigest | getMessageDigest()
Returns the MessageDigest associated with this DigestInputStream
|
void | on(boolean on)
Sets the flag specifing if this DigestInputStream updates the
digest in the write() methods. |
int | read()
Reads a byte from the input stream and updates the digest.
|
int | read(byte[] b, int off, int len)
Reads bytes from the input stream and updates the digest.
|
void | setMessageDigest(MessageDigest digest)
Sets the current MessageDigest to current parameter
|
String | toString()
Converts the input stream and underlying message digest to a string.
|
Parameters: stream An InputStream to associate this stream with digest A MessageDigest to hash the stream with
Returns: The MessageDigest used to hash this stream
Parameters: on True means it digests stream, false means it does not
Returns: Returns a byte from the input stream, -1 is returned to indicate that the end of stream was reached before this read call
Throws: IOException if an IO error occurs in the underlying input stream, this error is thrown
Parameters: b a byte array to store the data from the input stream off an offset to start at in the array len length of data to read
Returns: Returns count of bytes read, -1 is returned to indicate that the end of stream was reached before this read call
Throws: IOException if an IO error occurs in the underlying input stream, this error is thrown
Parameters: digest A MessageDigest to associate with this stream
Returns: A string representing the input stream and message digest.