public class ChecksumInputStream
extends java.io.FilterInputStream
Constructor and Description |
---|
ChecksumInputStream(java.io.InputStream stream,
Checksummer cksummer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the subsumed stream.
|
Checksummer |
getChecksummer()
Returns the Checksummer object.
|
long |
getNBytes()
Returns the byte count to date on the stream.
|
int |
read()
Reads a byte from the subsumed stream, updating
the byte count and the checksums.
|
int |
read(byte[] b)
Reads some number of bytes from the input stream and
stores them into the buffer array b.
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream
into an array of bytes.
|
long |
skip(long n)
Skips n bytes.
|
public ChecksumInputStream(java.io.InputStream stream, Checksummer cksummer)
stream
- Stream to be filteredcksummer
- Object to calculate checksum on the bytes
as they are readpublic int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.FilterInputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.io.IOException
public long getNBytes()
public Checksummer getChecksummer()