public class ChecksumValidatingInputStream extends InputStream implements Abortable
| Constructor and Description |
|---|
ChecksumValidatingInputStream(InputStream in,
SdkChecksum cksum,
long streamLength)
Creates an input stream using the specified Checksum, input stream, and length.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort() |
void |
close() |
int |
read()
Reads one byte at a time from the input stream, updates the checksum.
|
int |
read(byte[] buf,
int off,
int len)
Reads up to len bytes at a time from the input stream, updates the checksum.
|
void |
reset()
Resets stream state, including the running checksum.
|
available, mark, markSupported, read, skippublic ChecksumValidatingInputStream(InputStream in, SdkChecksum cksum, long streamLength)
in - the input streamcksum - the Checksum implementationstreamLength - the total length of the expected stream (including the extra 4 bytes on the end).public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buf,
int off,
int len)
throws IOException
read in class InputStreambuf - buffer to write intooff - offset in the buffer to write tolen - maximum number of bytes to attempt to read.IOExceptionpublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionCopyright © 2022. All rights reserved.