|Constructor and Description|
Creates a new instance.
|Modifier and Type||Method and Description|
Closes this input stream and releases any system resources associated with the stream.
Returns, whether this stream is already closed.
Called to indicate, that the input streams limit has been exceeded.
Reads the next byte of data from this input stream.
Reads up to
available, mark, markSupported, read, reset, skip
public LimitedInputStream(InputStream inputStream, long pSizeMax)
inputStream- The input stream, which shall be limited.
pSizeMax- The limit; no more than this number of bytes shall be returned by the source stream.
protected abstract void raiseError(long pSizeMax, long pCount) throws IOException
pSizeMax- The input streams limit, in bytes.
pCount- The actual number of bytes.
IOException- The called method is expected to raise an IOException.
public int read() throws IOException
intin the range
255. If no byte is available because the end of the stream has been reached, the value
-1is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.
in.read() and returns the result.
public int read(byte b, int off, int len) throws IOException
lenbytes of data from this input stream into an array of bytes. If
lenis not zero, the method blocks until some input is available; otherwise, no bytes are read and
This method simply performs
in.read(b, off, len)
and returns the result.
b- the buffer into which the data is read.
off- The start offset in the destination array
len- the maximum number of bytes read.
-1if there is no more data because the end of the stream has been reached.
lenis negative, or
lenis greater than
b.length - off
IOException- if an I/O error occurs.
public boolean isClosed() throws IOException
IOException- An I/O error occurred.
public void close() throws IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.