public class ChecksumCalculatingInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
private java.util.zip.Checksum |
checksum |
private java.io.InputStream |
in |
Constructor and Description |
---|
ChecksumCalculatingInputStream(java.util.zip.Checksum checksum,
java.io.InputStream in) |
Modifier and Type | Method and Description |
---|---|
long |
getValue()
Returns the calculated checksum.
|
int |
read()
Reads a single byte from the stream
|
int |
read(byte[] b)
Reads a byte array from the stream
|
int |
read(byte[] b,
int off,
int len)
Reads from the stream into a byte array.
|
long |
skip(long n) |
private final java.io.InputStream in
private final java.util.zip.Checksum checksum
public ChecksumCalculatingInputStream(java.util.zip.Checksum checksum, java.io.InputStream in)
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if the underlying stream throws or the
stream is exhausted and the Checksum doesn't match the expected
valuepublic int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if the underlying stream throws or the
stream is exhausted and the Checksum doesn't match the expected
valuepublic int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if the underlying stream throws or the
stream is exhausted and the Checksum doesn't match the expected
valuepublic long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public long getValue()