|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.OutputStream | +--java.io.FilterOutputStream | +--com.novell.java.security.DigestOutputStream
Provides a transparent stream that updates the associated message digest using the bits going through the stream. To complete the message digest computation, call one of the digest methods on the associated message digest after calling one of this digest ouput stream's write() methods.
It is possible to turn this stream ON or OFF by calling the on() method. When it is ON, a call to write() results in an update on the message digest. When the output stream is OFF, the message digest is not updated. The default is for the stream to be ON.
MessageDigest
,
DigestInputStream
Constructor Summary | |
DigestOutputStream(java.io.OutputStream stream,
MessageDigest digest)
Creates a digest output stream using the specified output stream and message digest. |
Method Summary | |
MessageDigest |
getMessageDigest()
Returns the message digest associated with this stream. |
void |
on(boolean on)
Turns the digest function ON (default) or OFF. |
void |
setMessageDigest(MessageDigest digest)
Associates the specified message digest with this stream. |
java.lang.String |
toString()
Prints a String representation of this digest output stream and its associated message digest object. |
void |
write(byte[] b,
int off,
int len)
Updates the message digest using the specified subarray, and writes the subarray to the output stream. |
void |
write(int b)
Updates the message digest using the specified byte. |
Methods inherited from class java.io.FilterOutputStream |
close,
flush,
write |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public DigestOutputStream(java.io.OutputStream stream, MessageDigest digest)
stream
- The output stream.digest
- The message digest to associate with this stream.Method Detail |
public MessageDigest getMessageDigest()
public void setMessageDigest(MessageDigest digest)
digest
- The message digest to be associated with this
stream.public void write(int b) throws java.io.IOException
b
- The byte to be used for updating and writing to the
output stream.MessageDigest.update(byte)
public void write(byte[] b, int off, int len) throws java.io.IOException
b
- The array containing the subarray to be used for
updating and writing to the output stream.off
- The offset into the byte array (b[]) of the first
byte to be updated and written.len
- The number of bytes of data to be updated and written
from the byte array (b[]), starting at offset specified by
the off parameter.MessageDigest.update(byte[], int, int)
public void on(boolean on)
on
- A boolean set to TRUE to turn the digest function ON,
and FALSE to turn it OFF.public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |