Class LimitedInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- java.io.FilterInputStream
- 
- org.apache.tomcat.util.http.fileupload.util.LimitedInputStream
 
 
 
- 
- 
Constructor SummaryConstructors Constructor Description LimitedInputStream(java.io.InputStream inputStream, long pSizeMax)Creates a new instance.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this input stream and releases any system resources associated with the stream.booleanisClosed()Returns, whether this stream is already closed.protected abstract voidraiseError(long pSizeMax, long pCount)Called to indicate, that the input streams limit has been exceeded.intread()Reads the next byte of data from this input stream.intread(byte[] b, int off, int len)Reads up tolenbytes of data from this input stream into an array of bytes.- 
Methods inherited from class java.io.FilterInputStreamavailable, mark, markSupported, read, reset, skip
 
- 
 
- 
- 
- 
Constructor Detail- 
LimitedInputStreampublic LimitedInputStream(java.io.InputStream inputStream, long pSizeMax)Creates a new instance.- Parameters:
- 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.
 
 
- 
 - 
Method Detail- 
raiseErrorprotected abstract void raiseError(long pSizeMax, long pCount) throws java.io.IOExceptionCalled to indicate, that the input streams limit has been exceeded.- Parameters:
- pSizeMax- The input streams limit, in bytes.
- pCount- The actual number of bytes.
- Throws:
- java.io.IOException- The called method is expected to raise an IOException.
 
 - 
readpublic int read() throws java.io.IOExceptionReads the next byte of data from this input stream. The value byte is returned as anintin the range0to255. 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.This method simply performs in.read()and returns the result.- Overrides:
- readin class- java.io.FilterInputStream
- Returns:
- the next byte of data, or -1if the end of the stream is reached.
- Throws:
- java.io.IOException- if an I/O error occurs.
- See Also:
- FilterInputStream.in
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOExceptionReads up tolenbytes of data from this input stream into an array of bytes. Iflenis not zero, the method blocks until some input is available; otherwise, no bytes are read and0is returned.This method simply performs in.read(b, off, len)and returns the result.- Overrides:
- readin class- java.io.FilterInputStream
- Parameters:
- 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.
- Returns:
- the total number of bytes read into the buffer, or
             -1if there is no more data because the end of the stream has been reached.
- Throws:
- java.lang.NullPointerException- If- bis- null.
- java.lang.IndexOutOfBoundsException- If- offis negative,- lenis negative, or- lenis greater than- b.length - off
- java.io.IOException- if an I/O error occurs.
- See Also:
- FilterInputStream.in
 
 - 
isClosedpublic boolean isClosed() throws java.io.IOExceptionReturns, whether this stream is already closed.
 - 
closepublic void close() throws java.io.IOExceptionCloses this input stream and releases any system resources associated with the stream. This method simply performsin.close().
 
- 
 
-