Package org.apache.catalina.connector
Class InputBuffer
- java.lang.Object
- 
- java.io.Reader
- 
- org.apache.catalina.connector.InputBuffer
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable,- java.lang.Readable,- ByteChunk.ByteInputChannel,- ApplicationBufferHandler
 
 public class InputBuffer extends java.io.Reader implements ByteChunk.ByteInputChannel, ApplicationBufferHandler The buffer used by Tomcat request. This is a derivative of the Tomcat 3.3 OutputBuffer, adapted to handle input instead of output. This allows complete recycling of the facade objects (the ServletInputStream and the BufferedReader).- Author:
- Remy Maucherat
 
- 
- 
Field SummaryFields Modifier and Type Field Description intBYTE_STATEintCHAR_STATEprotected B2CConverterconvCurrent byte to char converter.static intDEFAULT_BUFFER_SIZEintINITIAL_STATEprotected static StringManagersmThe string manager for this package.- 
Fields inherited from interface org.apache.tomcat.util.net.ApplicationBufferHandlerEMPTY, EMPTY_BUFFER
 
- 
 - 
Constructor SummaryConstructors Constructor Description InputBuffer()Default constructor.InputBuffer(int size)Alternate constructor which allows specifying the initial buffer size.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidcheckConverter()voidclose()Close the input buffer.voidexpand(int size)java.nio.ByteBuffergetByteBuffer()booleanisFinished()booleanisReady()voidmark(int readAheadLimit)booleanmarkSupported()intread()intread(byte[] b, int off, int len)intread(char[] cbuf)intread(char[] cbuf, int off, int len)intread(java.nio.ByteBuffer to)Transfers bytes from the buffer to the specified ByteBuffer.intreadByte()booleanready()intrealReadBytes()Reads new bytes in the byte chunk.intrealReadChars()voidrecycle()Recycle the output buffer.voidreset()voidsetByteBuffer(java.nio.ByteBuffer buffer)voidsetReadListener(ReadListener listener)voidsetRequest(Request coyoteRequest)Associated Coyote request.longskip(long n)
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm The string manager for this package.
 - 
DEFAULT_BUFFER_SIZEpublic static final int DEFAULT_BUFFER_SIZE - See Also:
- Constant Field Values
 
 - 
INITIAL_STATEpublic final int INITIAL_STATE - See Also:
- Constant Field Values
 
 - 
CHAR_STATEpublic final int CHAR_STATE - See Also:
- Constant Field Values
 
 - 
BYTE_STATEpublic final int BYTE_STATE - See Also:
- Constant Field Values
 
 - 
convprotected B2CConverter conv Current byte to char converter.
 
- 
 - 
Method Detail- 
setRequestpublic void setRequest(Request coyoteRequest) Associated Coyote request.- Parameters:
- coyoteRequest- Associated Coyote request
 
 - 
recyclepublic void recycle() Recycle the output buffer.
 - 
closepublic void close() throws java.io.IOExceptionClose the input buffer.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Specified by:
- closein class- java.io.Reader
- Throws:
- java.io.IOException- An underlying IOException occurred
 
 - 
availablepublic int available() 
 - 
setReadListenerpublic void setReadListener(ReadListener listener) 
 - 
isFinishedpublic boolean isFinished() 
 - 
isReadypublic boolean isReady() 
 - 
realReadBytespublic int realReadBytes() throws java.io.IOExceptionReads new bytes in the byte chunk.- Specified by:
- realReadBytesin interface- ByteChunk.ByteInputChannel
- Returns:
- The number of bytes read
- Throws:
- java.io.IOException- An underlying IOException occurred
 
 - 
readBytepublic int readByte() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
readpublic int read(java.nio.ByteBuffer to) throws java.io.IOExceptionTransfers bytes from the buffer to the specified ByteBuffer. After the operation the position of the ByteBuffer will be returned to the one before the operation, the limit will be the position incremented by the number of the transferred bytes.- Parameters:
- to- the ByteBuffer into which bytes are to be written.
- Returns:
- an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached
- Throws:
- java.io.IOException- if an input or output exception has occurred
 
 - 
realReadCharspublic int realReadChars() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
readpublic int read() throws java.io.IOException- Overrides:
- readin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
readpublic int read(char[] cbuf) throws java.io.IOException- Overrides:
- readin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
readpublic int read(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
- readin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
skippublic long skip(long n) throws java.io.IOException- Overrides:
- skipin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
readypublic boolean ready() throws java.io.IOException- Overrides:
- readyin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
markSupportedpublic boolean markSupported() - Overrides:
- markSupportedin class- java.io.Reader
 
 - 
markpublic void mark(int readAheadLimit) throws java.io.IOException- Overrides:
- markin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
resetpublic void reset() throws java.io.IOException- Overrides:
- resetin class- java.io.Reader
- Throws:
- java.io.IOException
 
 - 
checkConverterpublic void checkConverter() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
setByteBufferpublic void setByteBuffer(java.nio.ByteBuffer buffer) - Specified by:
- setByteBufferin interface- ApplicationBufferHandler
 
 - 
getByteBufferpublic java.nio.ByteBuffer getByteBuffer() - Specified by:
- getByteBufferin interface- ApplicationBufferHandler
 
 - 
expandpublic void expand(int size) - Specified by:
- expandin interface- ApplicationBufferHandler
 
 
- 
 
-