|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream org.apache.tomcat.util.http.fileupload.LimitedInputStream
public abstract class LimitedInputStream
An input stream, which limits its data size. This stream is used, if the content length is unknown.
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
LimitedInputStream(java.io.InputStream pIn,
long pSizeMax)
Creates a new instance. |
Method Summary | |
---|---|
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
boolean |
isClosed()
Returns, whether this stream is already closed. |
protected abstract void |
raiseError(long pSizeMax,
long pCount)
Called to indicate, that the input streams limit has been exceeded. |
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input stream
into an array of bytes. |
Methods inherited from class java.io.FilterInputStream |
---|
available, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LimitedInputStream(java.io.InputStream pIn, long pSizeMax)
pIn
- The input stream, which shall be limited.pSizeMax
- The limit; no more than this number of bytes
shall be returned by the source stream.Method Detail |
---|
protected abstract void raiseError(long pSizeMax, long pCount) throws java.io.IOException
pSizeMax
- The input streams limit, in bytes.pCount
- The actual number of bytes.
java.io.IOException
- The called method is expected
to raise an IOException.public int read() throws java.io.IOException
int
in the range
0
to 255
. If no byte is available
because the end of the stream has been reached, the value
-1
is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
This method
simply performs in.read()
and returns the result.
read
in class java.io.FilterInputStream
-1
if the end of the
stream is reached.
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
public int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes of data from this input stream
into an array of bytes. If len
is not zero, the method
blocks until some input is available; otherwise, no
bytes are read and 0
is returned.
This method simply performs in.read(b, off, len)
and returns the result.
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read.off
- The start offset in the destination array
b
.len
- the maximum number of bytes read.
-1
if there is no more data because the end of
the stream has been reached.
java.lang.NullPointerException
- If b
is null
.
java.lang.IndexOutOfBoundsException
- If off
is negative,
len
is negative, or len
is greater than
b.length - off
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
public boolean isClosed() throws java.io.IOException
java.io.IOException
- An I/O error occurred.public void close() throws java.io.IOException
in.close()
.
close
in interface java.io.Closeable
close
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurs.FilterInputStream.in
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |