public class LimitedInputStream extends FilterInputStream
FilterInputStream 实现| Modifier and Type | Field and Description |
|---|---|
protected long |
limit |
in| Constructor and Description |
|---|
LimitedInputStream(InputStream in,
long limit)
构造
|
LimitedInputStream(InputStream in,
long limit,
boolean throwWhenReachLimit)
构造
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long len) |
close, mark, markSupported, read, resetpublic LimitedInputStream(InputStream in, long limit)
in - InputStreamlimit - 限制最大读取量,单位bytepublic LimitedInputStream(InputStream in, long limit, boolean throwWhenReachLimit)
in - InputStreamlimit - 限制最大读取量,单位bytethrowWhenReachLimit - 是否在达到限制时抛出异常,false则读取到限制后返回-1public int read()
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionpublic long skip(long len)
throws IOException
skip in class FilterInputStreamIOExceptionpublic int available()
throws IOException
available in class FilterInputStreamIOExceptionCopyright © 2025. All rights reserved.