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
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 -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()booleanReturns 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 readMethods inherited from class jakarta.servlet.ServletInputStream
readLineMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
ServletInputStreamImpl
-
-
Method Details
-
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:
-
setReadListener
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
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-