org.eclipse.webdav.internal.authentication
Class DigestOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.eclipse.webdav.internal.authentication.DigestOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class DigestOutputStream
- extends FilterOutputStream
An OutputStream
that filters its data through a
MessageDigest
to compute a hash value over the data.
Constructor Summary |
DigestOutputStream(OutputStream out,
String algorithm)
Creates a new DigestOutputStream that filters its data
through a MessageDigest that hashes its input using the
given algorithm. |
DigestOutputStream(String algorithm)
Creates a new DigestOutputStream that filters its data
through a MessageDigest that hashes its input using the
given algorithm. |
Method Summary |
byte[] |
digest()
Completes the hash computation and resets the digest. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DigestOutputStream
public DigestOutputStream(OutputStream out,
String algorithm)
throws NoSuchAlgorithmException
- Creates a new
DigestOutputStream
that filters its data
through a MessageDigest
that hashes its input using the
given algorithm.
- Parameters:
out
- the data is also written to the given output streamalgorithm
- a hashing algorithm, for example: "MD5"
- Throws:
NoSuchAlgorithmException
DigestOutputStream
public DigestOutputStream(String algorithm)
throws NoSuchAlgorithmException
- Creates a new
DigestOutputStream
that filters its data
through a MessageDigest
that hashes its input using the
given algorithm.
- Parameters:
algorithm
- a hashing algorithm, for example: "MD5"
- Throws:
NoSuchAlgorithmException
digest
public byte[] digest()
- Completes the hash computation and resets the digest.
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
- See Also:
OutputStream.write(byte[], int, int)
write
public void write(int b)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
- See Also:
OutputStream.write(int)
Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.