Package org.glassfish.grizzly.servlet
Class ServletInputStreamImpl
java.lang.Object
java.io.InputStream
jakarta.servlet.ServletInputStream
org.glassfish.grizzly.servlet.ServletInputStreamImpl
- All Implemented Interfaces:
Closeable,AutoCloseable
- Author:
- Jeanfrancois Arcand
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedServletInputStreamImpl(HttpServletRequestImpl servletRequest) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Close the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us.voidbooleanReturns 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.voidmark(int readlimit) booleanintread()intread(byte[] b) intread(byte[] b, int off, int len) voidreset()voidsetReadListener(ReadListener readListener) Instructs theServletInputStreamto invoke the providedReadListenerwhen it is possible to readlongskip(long n) Methods inherited from class jakarta.servlet.ServletInputStream
readLineMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ServletInputStreamImpl
-
-
Method Details
-
initialize
- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
close
Close the stream Since we re-cycle, we can't allow the call to super.close() which would permanently disable us.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
isFinished
public boolean isFinished()Returns 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()Returns 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
Instructs 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.
-