public class CheckedInputStream extends FilterInputStream
Checksumin| Constructor and Description |
|---|
CheckedInputStream(InputStream in,
Checksum sum)
Creates a new CheckInputStream on top of the supplied OutputStream
using the supplied Checksum.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
available, close, mark, markSupported, read, resetfinalize, hashCodepublic CheckedInputStream(InputStream in, Checksum sum)
public Checksum getChecksum()
getChecksum.getValue().public int read()
throws IOException
read in class FilterInputStreamin.read()IOException - If an error occurspublic int read(byte[] buf,
int off,
int len)
throws IOException
read in class FilterInputStreambuf - 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 FilterInputStreamn - The requested number of bytes to skipin.skip(long)IOException - If an error occurs