Package io.undertow.servlet.spec
Class ServletInputStreamImpl
- java.lang.Object
-
- java.io.InputStream
-
- jakarta.servlet.ServletInputStream
-
- io.undertow.servlet.spec.ServletInputStreamImpl
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ServletInputStreamImpl extends ServletInputStream
Servlet input stream implementation. This stream is non-buffered, and is used for both HTTP requests and for upgraded streams.- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description ServletInputStreamImpl(HttpServletRequestImpl request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()booleanisFinished()Returns true when all the data from the stream has been read else it returns false.booleanisReady()Returns true if data can be read without blocking else returns false.intread()intread(byte[] b)intread(byte[] b, int off, int len)voidsetReadListener(ReadListener readListener)Instructs theServletInputStreamto invoke the providedReadListenerwhen it is possible to read-
Methods inherited from class jakarta.servlet.ServletInputStream
readLine
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
ServletInputStreamImpl
public ServletInputStreamImpl(HttpServletRequestImpl request)
-
-
Method Detail
-
isFinished
public boolean isFinished()
Description copied from class:ServletInputStreamReturns true when all the data from the stream has been read else it returns false.- Specified by:
isFinishedin classServletInputStream- Returns:
truewhen all data for this particular request has been read, otherwise returnsfalse.
-
isReady
public boolean isReady()
Description copied from class:ServletInputStreamReturns true if data can be read without blocking else returns false.If this method returns false and a
ReadListenerhas been set viaServletInputStream.setReadListener(ReadListener), then the container will subsequently invokeReadListener.onDataAvailable()(orReadListener.onAllDataRead()) once data (or EOF) has become available. Other than the initial call,ReadListener.onDataAvailable()will only be called if and only if this method is called and returns false.- Specified by:
isReadyin classServletInputStream- Returns:
trueif data can be obtained without blocking, otherwise returnsfalse.- See Also:
ReadListener
-
setReadListener
public void setReadListener(ReadListener readListener)
Description copied from class:ServletInputStreamInstructs theServletInputStreamto invoke the providedReadListenerwhen it is possible to read- Specified by:
setReadListenerin classServletInputStream- Parameters:
readListener- theReadListenerthat should be notified when it's possible to read.
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-