is new.
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.util.zip.CheckedInputStream
public class CheckedInputStream
An input stream that also maintains a checksum of the data being read. The checksum can then be used to verify the integrity of the input data.
| Field Summary |
|---|
| Fields inherited from class java.io. FilterInputStream |
|---|
| in |
| Constructor Summary | |
|---|---|
|
CheckedInputStream
(
InputStream
in,
Checksum
cksum) Creates an input stream using the specified Checksum. |
|
| Method Summary | |
|---|---|
| Checksum |
getChecksum
() Returns the Checksum for this input stream. |
| int |
read
() Reads a byte. |
| int |
read
(byte[] buf, int off, int len) Reads into an array of bytes. |
| long |
skip
(long n) Skips specified number of bytes of input. |
| 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 cksum)
| Method Detail |
|---|
public int read()
throws IOException
public int read(byte[] buf,
int off,
int len)
throws IOException
If len is not zero, the method blocks until some input is available; otherwise, no bytes are read and 0 is returned.
in
destination array b
NullPointerException
- If buf is null.
IndexOutOfBoundsException
- If off is negative, len is negative, or len is greater than buf.length - off
public long skip(long n)
throws IOException
public Checksum getChecksum()