public class DigestWriter
extends java.io.FilterWriter
Modifier and Type | Field and Description |
---|---|
protected java.security.MessageDigest |
digest
The message digest associated with this stream.
|
Constructor and Description |
---|
DigestWriter(java.io.Writer writer,
java.security.MessageDigest digest)
Creates a digest writer, using the specified writer and message digest.
|
Modifier and Type | Method and Description |
---|---|
java.security.MessageDigest |
getMessageDigest()
Returns the message digest associated with this writer.
|
void |
on(boolean on)
Turns the digest function on or off.
|
void |
setMessageDigest(java.security.MessageDigest digest)
Associates the specified message digest with this writer.
|
java.lang.String |
toString()
Prints a string representation of this digest output stream and its associated message digest object.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(java.lang.String str,
int off,
int len) |
protected java.security.MessageDigest digest
public DigestWriter(java.io.Writer writer, java.security.MessageDigest digest)
writer
- the writer.digest
- the message digest to associate with this writer.public java.security.MessageDigest getMessageDigest()
setMessageDigest(java.security.MessageDigest)
public void setMessageDigest(java.security.MessageDigest digest)
digest
- the message digest to be associated with this writer.getMessageDigest()
public void write(int c) throws java.io.IOException
write
in class java.io.FilterWriter
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.FilterWriter
java.io.IOException
public void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.FilterWriter
java.io.IOException
public void on(boolean on)
write
methods results in an update on the message digest. But when it is off, the message digest is not updated.on
- true to turn the digest function on, false to turn it off.public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html