|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
edu.rice.cs.plt.io.DirectOutputStream
edu.rice.cs.plt.io.MessageDigestOutputStream
public class MessageDigestOutputStream
A stream that accumulates its bytes in a MessageDigest
object.
Field Summary |
---|
Fields inherited from class edu.rice.cs.plt.io.DirectOutputStream |
---|
DEFAULT_BUFFER_SIZE |
Constructor Summary | |
---|---|
MessageDigestOutputStream(MessageDigest messageDigest)
Instantiate with the given MessageDigest. |
Method Summary | |
---|---|
void |
close()
|
byte[] |
digest()
Return messageDigest.digest() . |
void |
flush()
|
static MessageDigestOutputStream |
makeMD5()
Create a stream for computing MD5 hashes. |
static MessageDigestOutputStream |
makeSHA1()
Create a stream for computing SHA-1 hashes. |
static MessageDigestOutputStream |
makeSHA256()
Create a stream for computing SHA-256 hashes. |
void |
write(byte[] bbuf)
Delegate to the more general DirectOutputStream.write(byte[], int, int) method |
void |
write(byte[] bbuf,
int offset,
int len)
Subclasses are, at a minimum, required to implement this method. |
void |
write(int b)
Delegate to the more general DirectOutputStream.write(byte[], int, int) method |
Methods inherited from class edu.rice.cs.plt.io.DirectOutputStream |
---|
write, write, write, writeAll, writeAll, writeAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageDigestOutputStream(MessageDigest messageDigest)
messageDigest
will not be reset, and
may contain a partially-computed digest.
Method Detail |
---|
public byte[] digest()
messageDigest.digest()
.
public void close()
close
in interface Closeable
close
in class OutputStream
public void flush()
flush
in interface Flushable
flush
in class OutputStream
public void write(byte[] bbuf)
DirectOutputStream
DirectOutputStream.write(byte[], int, int)
method
write
in class DirectOutputStream
public void write(byte[] bbuf, int offset, int len)
DirectOutputStream
write
in class DirectOutputStream
public void write(int b)
DirectOutputStream
DirectOutputStream.write(byte[], int, int)
method
write
in class DirectOutputStream
public static MessageDigestOutputStream makeMD5()
RuntimeException
with a
NoSuchAlgorithmException
cause if the MD5 algorithm implementation cannot be located.
public static MessageDigestOutputStream makeSHA1()
RuntimeException
with a
NoSuchAlgorithmException
cause if the SHA-1 algorithm implementation cannot be located.
public static MessageDigestOutputStream makeSHA256()
RuntimeException
with a
NoSuchAlgorithmException
cause if the SHA-256 algorithm implementation cannot be located.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |