<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.security.DigestInputStream
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.security.html">This Package</a>  <a href="Package-java.security.html">Previous</a>  <a href="java.security.DigestOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.security.DigestInputStream
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.InputStream.html#_top_">java.io.InputStream</a>
           |
           +----<a href="java.io.FilterInputStream.html#_top_">java.io.FilterInputStream</a>
                   |
                   +----java.security.DigestInputStream
</pre>
<hr>
<dl>
  <dt> public class <b>DigestInputStream</b>
  <dt> extends <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
</dl>
A transparent stream that updates the associated message digest using
 the bits going through the stream.
 <p>To complete the message digest computation, call one of the
 <code>digest</code> methods on the associated message
 digest after your calls to one of this digest input stream's <a href =
 "#read()">read</a> methods.
 <p>It is possible to turn this stream on or off (see <a href =
 "#on">on</a>). When it is on, a call to <code>read</code>
 results in an update on the message digest.  But when it is off,
 the message digest is not updated. The default is for the stream
 to be on.
 <p>Note that digest objects can compute only one digest (see
 MessageDigest),
 so that in order to compute intermediate digests, a caller should
 retain a handle onto the digest object, and clone it for each
 digest to be computed, leaving the orginal digest untouched.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.security.MessageDigest.html#_top_">MessageDigest</a>, <a href="java.security.DigestOutputStream.html#_top_">DigestOutputStream</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#digest"><b>digest</b></a>
  <dd>  The message digest associated with this stream.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DigestInputStream(java.io.InputStream, java.security.MessageDigest)"><b>DigestInputStream</b></a>(InputStream, MessageDigest)
  <dd>  Creates a digest input stream, using the specified input stream
 and message digest.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getMessageDigest()"><b>getMessageDigest</b></a>()
  <dd>  Returns the message digest associated with this stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#on(boolean)"><b>on</b></a>(boolean)
  <dd>  Turns the digest function on or off.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read()"><b>read</b></a>()
  <dd>  Reads a byte, and updates the message digest (if the digest
 function is on).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read(byte[], int, int)"><b>read</b></a>(byte[], int, int)
  <dd>  Reads into a byte array, and updates the message digest (if the
 digest function is on).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setMessageDigest(java.security.MessageDigest)"><b>setMessageDigest</b></a>(MessageDigest)
  <dd>  Associates the specified message digest with this stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Prints a string representation of this digest input stream and
 its associated message digest object.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="digest"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>digest</b>
<pre>
 protected <a href="java.security.MessageDigest.html#_top_">MessageDigest</a> digest
</pre>
<dl>
  <dd> The message digest associated with this stream.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="DigestInputStream"></a>
<a name="DigestInputStream(java.io.InputStream, java.security.MessageDigest)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>DigestInputStream</b>
<pre>
 public DigestInputStream(<a href="java.io.InputStream.html#_top_">InputStream</a> stream,
                          <a href="java.security.MessageDigest.html#_top_">MessageDigest</a> digest)
</pre>
<dl>
  <dd> Creates a digest input stream, using the specified input stream
 and message digest.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> stream - the input stream.
    <dd> digest - the message digest to associate with this stream.
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="getMessageDigest()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getMessageDigest"><b>getMessageDigest</b></a>
<pre>
 public <a href="java.security.MessageDigest.html#_top_">MessageDigest</a> getMessageDigest()
</pre>
<dl>
  <dd> Returns the message digest associated with this stream.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the message digest associated with this stream.
  </dl></dd>
</dl>
<a name="setMessageDigest(java.security.MessageDigest)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setMessageDigest"><b>setMessageDigest</b></a>
<pre>
 public void setMessageDigest(<a href="java.security.MessageDigest.html#_top_">MessageDigest</a> digest)
</pre>
<dl>
  <dd> Associates the specified message digest with this stream.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> digest - the message digest to be associated with this stream.
  </dl></dd>
</dl>
<a name="read()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="read"><b>read</b></a>
<pre>
 public int read() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Reads a byte, and updates the message digest (if the digest
 function is on).  That is, this method reads a byte from the
 input stream, blocking until the byte is actually read. If the
 digest function is on (see <a href = "#on">on</a>), this method
 will then call <code>update</code> on the message digest associated
 with this stream, passing it the byte read.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the byte read.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterInputStream.html#read()">read</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.security.MessageDigest.html#update(byte)">update</a>
  </dl></dd>
</dl>
<a name="read(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="read"><b>read</b></a>
<pre>
 public int read(byte b[],
                 int off,
                 int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Reads into a byte array, and updates the message digest (if the
 digest function is on).  That is, this method reads up to
 <code>len</code> bytes from the input stream into the array
 <code>b</code>, starting at offset <code>off</code>. This method
 blocks until the data is actually
 read. If the digest function is on (see <a href =
 "#on">on</a>), this method will then call <code>update</code>
 on the message digest associated with this stream, passing it
 the data.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the array into which the data is read.
    <dd> off - the starting offset into <code>b</code> of where the
 data should be placed.
    <dd> len - the maximum number of bytes to be read from the input
 stream into b, starting at offset <code>off</code>.
    <dt> <b>Returns:</b>
    <dd> the actual number of bytes read. This is less than
 <code>len</code> if the end of the stream is reached prior to
 reading <code>len</code> bytes. -1 is returned if no bytes were
 read because the end of the stream had already been reached when
 the call was made.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterInputStream.html#read(byte[], int, int)">read</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.security.MessageDigest.html#update(byte[], int, int)">update</a>
  </dl></dd>
</dl>
<a name="on(boolean)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="on"><b>on</b></a>
<pre>
 public void on(boolean on)
</pre>
<dl>
  <dd> Turns the digest function on or off. The default is on.  When
 it is on, a call to <a href = "#read">read</a> results in an
 update on the message digest.  But when it is off, the message
 digest is not updated.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> on - true to turn the digest function on, false to turn
 it off.
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Prints a string representation of this digest input stream and
 its associated message digest object.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.security.html">This Package</a>  <a href="Package-java.security.html">Previous</a>  <a href="java.security.DigestOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
