Class UpgradeServletOutputStream
java.lang.Object
java.io.OutputStream
jakarta.servlet.ServletOutputStream
org.apache.coyote.http11.upgrade.UpgradeServletOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
-
Constructor Summary
ConstructorDescriptionUpgradeServletOutputStream
(UpgradeProcessorBase processor, SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
final boolean
isReady()
Checks if a non-blocking write will succeed.final void
setWriteListener
(WriteListener listener) Sets theWriteListener
for thisServletOutputStream
and thereby switches to non-blocking IO.void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class jakarta.servlet.ServletOutputStream
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
UpgradeServletOutputStream
public UpgradeServletOutputStream(UpgradeProcessorBase processor, SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo)
-
-
Method Details
-
isReady
public final boolean isReady()Description copied from class:jakarta.servlet.ServletOutputStream
Checks if a non-blocking write will succeed. If this returnsfalse
, it will cause a callback toWriteListener.onWritePossible()
when the buffer has emptied. If this method returnsfalse
no further data must be written until the container callsWriteListener.onWritePossible()
.- Specified by:
isReady
in classServletOutputStream
- Returns:
true
if data can be written, elsefalse
-
setWriteListener
Description copied from class:jakarta.servlet.ServletOutputStream
Sets theWriteListener
for thisServletOutputStream
and 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:
setWriteListener
in classServletOutputStream
- Parameters:
listener
- The non-blocking IO write listener
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-