类 LengthCheckInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.baidubce.util.LengthCheckInputStream
-
- 所有已实现的接口:
Closeable,AutoCloseable
@NotThreadSafe public class LengthCheckInputStream extends FilterInputStream
Used to perform length check to ensure the number of bytes read from the underlying input stream is the same as the expected total.
-
-
字段概要
字段 修饰符和类型 字段 说明 static booleanEXCLUDE_SKIPPED_BYTESstatic booleanINCLUDE_SKIPPED_BYTES-
从类继承的字段 java.io.FilterInputStream
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.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidmark(int readlimit)intread()intread(byte[] b, int off, int len)voidreset()longskip(long n)-
从类继承的方法 java.io.FilterInputStream
available, close, markSupported, read
-
从类继承的方法 java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
构造器详细资料
-
LengthCheckInputStream
public 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.- 参数:
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 BCE, but set to true for receiving data from BCE.
-
-
方法详细资料
-
read
public int read() throws IOException- 覆盖:
read在类中FilterInputStream- 抛出:
BceClientException- if the data length read has exceeded the expected total, or if the total data length is not the same as the expected total.IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- 覆盖:
read在类中FilterInputStream- 抛出:
BceClientException- if the data length read has exceeded the expected total, or if the total data length is not the same as the expected total.IOException
-
mark
public void mark(int readlimit)
- 覆盖:
mark在类中FilterInputStream
-
reset
public void reset() throws IOException- 覆盖:
reset在类中FilterInputStream- 抛出:
IOException
-
skip
public long skip(long n) throws IOException- 覆盖:
skip在类中FilterInputStream- 抛出:
BceClientException- ifincludeSkippedis true and the data length skipped has exceeded the expected total.IOException
-
-