Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.security.crypto.core
Class DigestOutputStream

`java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
oracle.security.crypto.core.DigestOutputStream`

public class DigestOutputStream
extends java.io.FilterOutputStream

An output stream that keeps a message digest of the bytes going through it.

The computeCurrent() method computes and returns the current digest.

Field Summary
`protected MessageDigest` | `messageDigest` The message digest used by this stream.

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`DigestOutputStream(java.io.OutputStream os, MessageDigest md)` Create a new DigestOutputStream with specified OutputStream and Message Digest.

Method Summary
`byte[]` | `computeCurrent()` Compute and return the current message digest.
`MessageDigest` | `getMessageDigest()` Return the message digest for this stream.
`void` | `setMessageDigest(MessageDigest md)` Set the message digest for this stream.
`void` | `write(byte[] b, int off, int len)` Write a sub array of bytes.
`void` | `write(int b)` Write one byte of data.

Methods inherited from class java.io.FilterOutputStream
`close, flush, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### messageDigest

    protected MessageDigest messageDigest

  The message digest used by this stream.

Constructor Detail

### DigestOutputStream

    public DigestOutputStream(java.io.OutputStream os,
                              MessageDigest md)

  Create a new DigestOutputStream with specified OutputStream and Message Digest.

Method Detail

### write

    public void write(int b)
               throws java.io.IOException

  Write one byte of data. Blocks until byte is actually written. Updates the message digest.
  Throws:
    `java.io.IOException`

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException

  Write a sub array of bytes. Updates the message digest.
  Parameters:
    `b` - the data to be written
    `off` - start offset of data
    `len` - number of bytes to write
  Throws:
    `java.io.IOException`

### computeCurrent

    public byte[] computeCurrent()

  Compute and return the current message digest.

### getMessageDigest

    public MessageDigest getMessageDigest()

  Return the message digest for this stream.

### setMessageDigest

    public void setMessageDigest(MessageDigest md)

  Set the message digest for this stream.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005, 2006 , Oracle. All rights reserved.