|
|||||||||
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.util.zip.CheckedInputStream
public class CheckedInputStream
InputStream that computes a checksum of the data being read using a supplied Checksum object.
Checksum
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
CheckedInputStream(InputStream in,
Checksum sum)
Creates a new CheckInputStream on top of the supplied OutputStream using the supplied Checksum. |
Method Summary | |
---|---|
Checksum |
getChecksum()
Returns the Checksum object used. |
int |
read()
Reads one byte, updates the checksum and returns the read byte (or -1 when the end of file was reached). |
int |
read(byte[] buf,
int off,
int len)
Reads at most len bytes in the supplied buffer and updates the checksum with it. |
long |
skip(long n)
Skips n bytes by reading them in a temporary buffer and updating the the checksum with that buffer. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CheckedInputStream(InputStream in, Checksum sum)
Method Detail |
---|
public Checksum getChecksum()
getChecksum.getValue()
.
public int read() throws IOException
read
in class FilterInputStream
in.read()
IOException
- If an error occurspublic int read(byte[] buf, int off, int len) throws IOException
read
in class FilterInputStream
buf
- The buffer to read bytes intooff
- The index into the buffer to start storing byteslen
- The maximum number of bytes to read.
in.read(byte[], int, int)
IOException
- If an error occurspublic long skip(long n) throws IOException
skip
in class FilterInputStream
n
- The requested number of bytes to skip.
in.skip(long)
IOException
- If an error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |