public class LengthCheckInputStream extends FilterInputStream
| 限定符和类型 | 字段和说明 |
|---|---|
static boolean |
EXCLUDE_SKIPPED_BYTES |
static boolean |
INCLUDE_SKIPPED_BYTES |
in| 构造器和说明 |
|---|
LengthCheckInputStream(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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
mark(int readlimit) |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
available, close, markSupported, readpublic static final boolean INCLUDE_SKIPPED_BYTES
public static final boolean EXCLUDE_SKIPPED_BYTES
public LengthCheckInputStream(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 KS3, but set to true for
receiving data from KS3.public int read()
throws IOException
read 在类中 FilterInputStreamKs3ClientException - if the data length read has exceeded the expected total, or
if the total data length is not the same as the expected
total.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read 在类中 FilterInputStreamKs3ClientException - if the data length read has exceeded the expected total, or
if the total data length is not the same as the expected
total.IOExceptionpublic void mark(int readlimit)
mark 在类中 FilterInputStreampublic void reset()
throws IOException
reset 在类中 FilterInputStreamIOExceptionpublic long skip(long n)
throws IOException
skip 在类中 FilterInputStreamKs3ClientException - if includeSkipped is true and the data length
skipped has exceeded the expected total.IOExceptionCopyright © 2024. All rights reserved.