Package org.apache.catalina.connector
Class InputBuffer
- java.lang.Object
-
- java.io.Reader
-
- org.apache.catalina.connector.InputBuffer
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable,org.glassfish.grizzly.http.util.ByteChunk.ByteInputChannel,org.glassfish.grizzly.http.util.CharChunk.CharInputChannel,org.glassfish.grizzly.http.util.CharChunk.CharOutputChannel
public class InputBuffer extends Reader implements org.glassfish.grizzly.http.util.ByteChunk.ByteInputChannel, org.glassfish.grizzly.http.util.CharChunk.CharInputChannel, org.glassfish.grizzly.http.util.CharChunk.CharOutputChannel
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 Summary
Fields Modifier and Type Field Description static intDEFAULT_BUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description InputBuffer()Default constructor.InputBuffer(int size)Alternate constructor which does nothing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidcheckConverter()voidclose()Close the input buffer.org.glassfish.grizzly.http.server.RequestgetRequest()Get associated Grizzly request.booleanisFinished()booleanisReady()voidmark(int readAheadLimit)booleanmarkSupported()intread()intread(byte[] b, int off, int len)intread(char[] cbuf)intread(char[] cbuf, int off, int len)intreadByte()booleanready()intrealReadBytes(byte[] cbuf, int off, int len)Reads new bytes in the byte chunk.intrealReadChars(char[] cbuf, int off, int len)voidrealWriteChars(char[] c, int off, int len)Since the converter will use append, it is possible to get chars to be removed from the buffer for "writing".voidrecycle()Recycle the output buffer.voidreset()voidsetEncoding(String encoding)voidsetReadListener(jakarta.servlet.ReadListener readListener)voidsetRequest(Request request)voidsetRequest(org.glassfish.grizzly.http.server.Request grizzlyRequest)Associated Grizzly request.longskip(long n)-
Methods inherited from class java.io.Reader
nullReader, read, transferTo
-
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setRequest
public void setRequest(org.glassfish.grizzly.http.server.Request grizzlyRequest)
Associated Grizzly request.- Parameters:
grizzlyRequest- Associated Grizzly request
-
setRequest
public void setRequest(Request request)
-
getRequest
public org.glassfish.grizzly.http.server.Request getRequest()
Get associated Grizzly request.- Returns:
- the associated Grizzly request
-
recycle
public void recycle()
Recycle the output buffer.
-
close
public void close() throws IOExceptionClose the input buffer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException- An underlying IOException occurred
-
available
public int available() throws IOException- Throws:
IOException
-
realReadBytes
public int realReadBytes(byte[] cbuf, int off, int len) throws IOExceptionReads new bytes in the byte chunk.- Specified by:
realReadBytesin interfaceorg.glassfish.grizzly.http.util.ByteChunk.ByteInputChannel- Parameters:
cbuf- Byte buffer to be written to the responseoff- Offsetlen- Length- Throws:
IOException- An underlying IOException occurred
-
readByte
public int readByte() throws IOException- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
isFinished
public boolean isFinished()
-
isReady
public boolean isReady()
-
setReadListener
public void setReadListener(jakarta.servlet.ReadListener readListener)
-
realWriteChars
public void realWriteChars(char[] c, int off, int len) throws IOExceptionSince the converter will use append, it is possible to get chars to be removed from the buffer for "writing". Since the chars have already been read before, they are ignored. If a mark was set, then the mark is lost.- Specified by:
realWriteCharsin interfaceorg.glassfish.grizzly.http.util.CharChunk.CharOutputChannel- Throws:
IOException
-
setEncoding
public void setEncoding(String encoding)
-
realReadChars
public int realReadChars(char[] cbuf, int off, int len) throws IOException- Specified by:
realReadCharsin interfaceorg.glassfish.grizzly.http.util.CharChunk.CharInputChannel- Throws:
IOException
-
read
public int read() throws IOException- Overrides:
readin classReader- Throws:
IOException
-
read
public int read(char[] cbuf) throws IOException- Overrides:
readin classReader- Throws:
IOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException- Specified by:
readin classReader- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classReader- Throws:
IOException
-
ready
public boolean ready() throws IOException- Overrides:
readyin classReader- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classReader
-
mark
public void mark(int readAheadLimit) throws IOException- Overrides:
markin classReader- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classReader- Throws:
IOException
-
checkConverter
public void checkConverter() throws IOException- Throws:
IOException
-
-