public class ChecksumValidatingInputStream extends InputStream implements Abortable
Constructor and Description |
---|
ChecksumValidatingInputStream(InputStream inputStream,
SdkChecksum sdkChecksum,
String expectedChecksum)
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 from the underlying stream.
|
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, skip
public ChecksumValidatingInputStream(InputStream inputStream, SdkChecksum sdkChecksum, String expectedChecksum)
inputStream
- the input streamsdkChecksum
- the Checksum implementationexpectedChecksum
- the checksum value as seen un .public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] buf, int off, int len) throws IOException
read
in class InputStream
buf
- buffer to write intooff
- offset in the buffer to write tolen
- maximum number of bytes to attempt to read.IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2023. All rights reserved.