<!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.DigestOutputStream
</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="java.security.DigestInputStream.html#_top_">Previous</a>  <a href="java.security.Identity.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.security.DigestOutputStream
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.OutputStream.html#_top_">java.io.OutputStream</a>
           |
           +----<a href="java.io.FilterOutputStream.html#_top_">java.io.FilterOutputStream</a>
                   |
                   +----java.security.DigestOutputStream
</pre>
<hr>
<dl>
  <dt> public class <b>DigestOutputStream</b>
  <dt> extends <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</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 ouput stream's <a href =
 "#write(int)">write</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>write</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>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.security.MessageDigest.html#_top_">MessageDigest</a>, <a href="java.security.DigestInputStream.html#_top_">DigestInputStream</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="#DigestOutputStream(java.io.OutputStream, java.security.MessageDigest)"><b>DigestOutputStream</b></a>(OutputStream, MessageDigest)
  <dd>  Creates a digest output stream, using the specified output 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="#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 output stream and
 its associated message digest object.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#write(byte[], int, int)"><b>write</b></a>(byte[], int, int)
  <dd>  Updates the message digest (if the digest function is on) using
 the specified subarray, and in any case writes the subarray to
 the output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#write(int)"><b>write</b></a>(int)
  <dd>  Updates the message digest (if the digest function is on) using
 the specified byte, and in any case writes the byte
 to the output stream.
</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="DigestOutputStream"></a>
<a name="DigestOutputStream(java.io.OutputStream, java.security.MessageDigest)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>DigestOutputStream</b>
<pre>
 public DigestOutputStream(<a href="java.io.OutputStream.html#_top_">OutputStream</a> stream,
                           <a href="java.security.MessageDigest.html#_top_">MessageDigest</a> digest)
</pre>
<dl>
  <dd> Creates a digest output stream, using the specified output stream
 and message digest.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> stream - the output 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="write(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="write"><b>write</b></a>
<pre>
 public void write(int b) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Updates the message digest (if the digest function is on) using
 the specified byte, and in any case writes the byte
 to the output stream. That is, if the digest function is on
 (see <a href = "#on">on</a>), this method calls
 <code>update</code> on the message digest associated with this
 stream, passing it the byte <code>b</code>. This method then
 writes the byte to the output stream, blocking until the byte
 is actually written.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the byte to be used for updating and writing to the
 output stream.
    <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.FilterOutputStream.html#write(int)">write</a> in class <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.security.MessageDigest.html#update(byte)">update</a>
  </dl></dd>
</dl>
<a name="write(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="write"><b>write</b></a>
<pre>
 public void write(byte b[],
                   int off,
                   int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Updates the message digest (if the digest function is on) using
 the specified subarray, and in any case writes the subarray to
 the output stream. That is, if the digest function is on (see
 <a href = "#on">on</a>), this method calls <code>update</code>
 on the message digest associated with this stream, passing it
 the subarray specifications. This method then writes the subarray
 bytes to the output stream, blocking until the bytes are actually
 written.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the array containing the subarray to be used for updating
 and writing to the output stream.
    <dd> off - the offset into <code>b</code> of the first byte to
 be updated and written.
    <dd> len - the number of bytes of data to be updated and written
 from <code>b</code>, starting at offset <code>off</code>.
    <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.FilterOutputStream.html#write(byte[], int, int)">write</a> in class <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</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 = "#write">write</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 output 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="java.security.DigestInputStream.html#_top_">Previous</a>  <a href="java.security.Identity.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
