public class LengthCheckInputStream extends SdkFilterInputStream
| Modifier and Type | Field and Description |
|---|---|
static boolean |
EXCLUDE_SKIPPED_BYTES
Exclude skipped bytes.
|
static boolean |
INCLUDE_SKIPPED_BYTES
Include skipped bytes.
|
| Constructor and Description |
|---|
LengthCheckInputStream(java.io.InputStream in,
long expectedLength,
boolean includeSkipped)
Constructs an input stream that performs length check to ensure the
number of bytes read from the underlying input stream is the same as the
expected total.
|
| Modifier and Type | Method and Description |
|---|---|
void |
mark(int readlimit) |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
abort, abortIfNeeded, available, close, isMetricActivated, markSupportedpublic static final boolean INCLUDE_SKIPPED_BYTES
public static final boolean EXCLUDE_SKIPPED_BYTES
public LengthCheckInputStream(java.io.InputStream in,
long expectedLength,
boolean includeSkipped)
in - the underlying input streamexpectedLength - the total length of the data in bytes expected to
be read from the underlying input stream; must be
non-negative.includeSkipped - true if bytes skipped are to be considered as part
of the data length; false otherwise. Typically, this parameter
should be set to false for uploading data to AWS, but set to
true for receiving data from AWS.public int read()
throws java.io.IOException
read in class SdkFilterInputStreamAmazonClientException - if the data length read has exceeded the
expected total, or if the total data length is not the same
as the expected total.java.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class SdkFilterInputStreamAmazonClientException - if the data length read has exceeded the
expected total, or if the total data length is not the same
as the expected total.java.io.IOExceptionpublic void mark(int readlimit)
mark in class SdkFilterInputStreampublic void reset()
throws java.io.IOException
reset in class SdkFilterInputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class SdkFilterInputStreamAmazonClientException - if includeSkipped is true and the
data length skipped has exceeded the expected total.java.io.IOException