Package org.apache.catalina.connector
Class CoyoteInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- javax.servlet.ServletInputStream
- 
- org.apache.catalina.connector.CoyoteInputStream
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 
 public class CoyoteInputStream extends ServletInputStream This class handles reading bytes.- Author:
- Remy Maucherat
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected InputBufferibprotected static StringManagersm
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedCoyoteInputStream(InputBuffer ib)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()protected java.lang.Objectclone()Prevent cloning the facade.voidclose()Close the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us.booleanisFinished()Has the end of this InputStream been reached?booleanisReady()Can data be read from this InputStream without blocking?intread()intread(byte[] b)intread(byte[] b, int off, int len)intread(java.nio.ByteBuffer b)Transfers bytes from the buffer to the specified ByteBuffer.voidsetReadListener(ReadListener listener)Sets theReadListenerfor thisServletInputStreamand thereby switches to non-blocking IO.- 
Methods inherited from class javax.servlet.ServletInputStreamreadLine
 
- 
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 - 
ibprotected InputBuffer ib 
 
- 
 - 
Constructor Detail- 
CoyoteInputStreamprotected CoyoteInputStream(InputBuffer ib) 
 
- 
 - 
Method Detail- 
cloneprotected java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionPrevent cloning the facade.- Overrides:
- clonein class- java.lang.Object
- Throws:
- java.lang.CloneNotSupportedException
 
 - 
readpublic int read() throws java.io.IOException- Specified by:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
availablepublic int available() throws java.io.IOException- Overrides:
- availablein class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b) throws java.io.IOException- Overrides:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(java.nio.ByteBuffer b) 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:
- b- 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
 
 - 
closepublic void close() throws java.io.IOExceptionClose the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
isFinishedpublic boolean isFinished() Description copied from class:javax.servlet.ServletInputStreamHas the end of this InputStream been reached?- Specified by:
- isFinishedin class- ServletInputStream
- Returns:
- trueif all the data has been read from the stream, else- false
 
 - 
isReadypublic boolean isReady() Description copied from class:javax.servlet.ServletInputStreamCan data be read from this InputStream without blocking? Returns If this method is called and returns false, the container will invokeReadListener.onDataAvailable()when data is available.- Specified by:
- isReadyin class- ServletInputStream
- Returns:
- trueif data can be read without blocking, else- false
 
 - 
setReadListenerpublic void setReadListener(ReadListener listener) Description copied from class:javax.servlet.ServletInputStreamSets theReadListenerfor thisServletInputStreamand thereby switches to non-blocking IO. It is only valid to switch to non-blocking IO within async processing or HTTP upgrade processing.- Specified by:
- setReadListenerin class- ServletInputStream
- Parameters:
- listener- The non-blocking IO read listener
 
 
- 
 
-