java.util.zip.CheckedInputStream
java.io.FilterInputStream
None
None
New as of JDK 1.1
The CheckedInputStream class represents an InputStream with an associated checksum. In other words, a CheckedInputStream wraps a regular input stream and computes a checksum value as data is read from the stream. The checksum can verify the integrity of the data. When you create a CheckedInputStream, you must specify an object that implements the Checksum interface that computes the checksum.
public class java.util.zip.CheckedInputStream extends java.io.FilterInputStream { // Constructors public CheckedInputStream(InputStream in, Checksum cksum); // Instance Methods public Checksum getChecksum(); public int read(); public int read(byte[] buf, int off, int len); public long skip(long n); }
The underlying input stream to use as a data source.
The checksum object.
This constructor creates a CheckedInputStream that reads data from the given InputStream and updates the given Checksum.
The Checksum associated with this input stream.
This method returns the Checksum object associated with this input stream.
The next byte from the stream or -1 if the end of the stream has been reached.
If any kind of I/O error occurs.
FilterInputStream.read()
This method reads the next byte from the underlying InputStream and then updates the checksum. The method blocks until some data is available, the end of the stream is detected, or an exception is thrown.
An array of bytes to be filled from the stream.
An offset into the byte array.
The number of bytes to read.
The number of bytes read or -1 if the end of the stream is encountered immediately.
If any kind of I/O error occurs.
FilterInputStream.read(byte[], int, int)
This method reads up to len bytes from the underlying InputStream and places them into the given array starting at off. The checksum is then updated with the data that has been read. The method blocks until some data is available.
The number of bytes to skip.
The actual number of bytes skipped.
If any kind of I/O error occurs.
FilterInputStream.skip()
This method skips over the specified number of bytes in the underlying InputStream. The skipped bytes are not calculated into the checksum.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
available() |
FilterInputStream |
clone() |
Object |
close() |
FilterInputStream |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
mark(int) |
FilterInputStream |
markSupported() |
FilterInputStream |
notify() |
Object |
notifyAll() |
Object |
read(byte[]) |
FilterInputStream |
reset() |
FilterInputStream |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
Checksum, FilterInputStream, InputStream, IOException