public class ChecksumCalculatingInputStream extends InputStream
Constructor and Description |
---|
ChecksumCalculatingInputStream(Checksum checksum,
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) |
available, close, mark, markSupported, reset
public ChecksumCalculatingInputStream(Checksum checksum, InputStream in)
public int read() throws IOException
read
in class InputStream
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 IOException
read
in class InputStream
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 IOException
read
in class InputStream
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 IOException
skip
in class InputStream
IOException
public long getValue()
Copyright © 2018 The Apache Software Foundation. All rights reserved.