public static class HTTPServer.LimitedInputStream extends FilterInputStream
LimitedInputStream provides access to a limited number
of consecutive bytes from the underlying InputStream, starting at its
current position. If this limit is reached, it behaves as though the end
of stream has been reached (although the underlying stream remains open
and may contain additional data).| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
limit |
protected boolean |
prematureEndException |
in| 构造器和说明 |
|---|
LimitedInputStream(InputStream in,
long limit,
boolean prematureEndException)
Constructs a LimitedInputStream with the given underlying
input stream and limit.
|
public LimitedInputStream(InputStream in, long limit, boolean prematureEndException)
in - the underlying input streamlimit - the maximum number of bytes that may be consumed from
the underlying stream before this stream ends. If zero or
negative, this stream will be at its end from initialization.prematureEndException - specifies the stream's behavior when
the underlying stream end is reached before the limit is
reached: if true, an exception is thrown, otherwise this
stream reaches its end as well (i.e. read() returns -1)NullPointerException - if the given stream is nullpublic int read()
throws IOException
read 在类中 FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read 在类中 FilterInputStreamIOExceptionpublic long skip(long len)
throws IOException
skip 在类中 FilterInputStreamIOExceptionpublic int available()
throws IOException
available 在类中 FilterInputStreamIOExceptionpublic boolean markSupported()
markSupported 在类中 FilterInputStreampublic void close()
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 FilterInputStreamCopyright © 2022. All rights reserved.