|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.security.DigestInputStream
public class DigestInputStream
| Field Summary | |
|---|---|
protected MessageDigest |
digest
|
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
DigestInputStream(InputStream stream,
MessageDigest digest)
|
|
| Method Summary | |
|---|---|
MessageDigest |
getMessageDigest()
Returns the MessageDigest which the receiver uses when computing the hash. |
void |
on(boolean on)
Enables or disables the digest function (default is on). |
int |
read()
Reads the next byte and returns it as an int. |
int |
read(byte[] b,
int off,
int len)
Reads at most count bytes from this FilterInputStream and
stores them in byte array buffer starting at
offset. |
void |
setMessageDigest(MessageDigest digest)
Sets the MessageDigest which the receiver will use when computing the hash. |
String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected MessageDigest digest
| Constructor Detail |
|---|
public DigestInputStream(InputStream stream,
MessageDigest digest)
| Method Detail |
|---|
public MessageDigest getMessageDigest()
public void setMessageDigest(MessageDigest digest)
digest - MessageDigest the digest to use when computing the hash.MessageDigest,
on(boolean)
public int read()
throws IOException
read in class FilterInputStreamIOException - If reading the source stream causes an IOException.
public int read(byte[] b,
int off,
int len)
throws IOException
FilterInputStreamcount bytes from this FilterInputStream and
stores them in byte array buffer starting at
offset. Answer the number of bytes actually read or -1 if
no bytes were read and end of stream was encountered. This implementation
reads bytes from the target stream.
read in class FilterInputStreamb - the byte array in which to store the read bytes.off - the offset in buffer to store the read bytes.len - the maximum number of bytes to store in buffer.
IOException - If the stream is already closed or another IOException
occurs.public void on(boolean on)
on - boolean true if the digest should be computed, and false
otherwise.MessageDigestpublic String toString()
toString in class Object
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||