This class is a
byte input stream with an associated
MessageDigest object. When bytes are read with any
of the read( )
methods, those bytes are automatically passed to the update(
)
method of the MessageDigest. When you have
finished reading bytes, you can call the digest(
) method of the
MessageDigest to obtain a message digest. If you
want to compute a digest just for some of the bytes read from the
stream, use on( )
to turn the digesting function on and off. Digesting is on by
default; call on(false) to turn it off. See also
DigestOutputStream and
MessageDigest.
Figure 14-8. java.security.DigestInputStream

public class DigestInputStream extends java.io.FilterInputStream {
// Public Constructors
public DigestInputStream (java.io.InputStream stream , MessageDigest digest );
// Public Instance Methods
public MessageDigest getMessageDigest ( );
public void on (boolean on );
public void setMessageDigest (MessageDigest digest );
// Public Methods Overriding FilterInputStream
public int read ( ) throws java.io.IOException;
public int read (byte[ ] b , int off , int len ) throws java.io.IOException;
// Public Methods Overriding Object
public String toString ( );
// Protected Instance Fields
protected MessageDigest digest ;
}