Class CoyoteOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
- Author:
- Costin Manolache, Remy Maucherat
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected Objectclone()Prevent cloning the facade.voidclose()voidflush()Will send the buffer to the client.booleanisReady()Returnstrueif it is allowable to call any method that may write data (e.g.voidsetWriteListener(WriteListener listener) Sets theWriteListenerfor thisServletOutputStreamand thereby switches to non-blocking IO.voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int i) voidwrite(ByteBuffer from) Writes from the given buffer to the output stream.Methods inherited from class jakarta.servlet.ServletOutputStreamprint, print, print, print, print, print, print, println, println, println, println, println, println, println, printlnMethods inherited from class java.io.OutputStreamnullOutputStream
- 
Field Details- 
sm
- 
ob
 
- 
- 
Constructor Details- 
CoyoteOutputStream
 
- 
- 
Method Details- 
clonePrevent cloning the facade.- Overrides:
- clonein class- Object
- Throws:
- CloneNotSupportedException
 
- 
write- Specified by:
- writein class- OutputStream
- Throws:
- IOException
 
- 
write- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
- 
write- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
- 
writeDescription copied from class:jakarta.servlet.ServletOutputStreamWrites from the given buffer to the output stream.If the output steam is in non-blocking mode, before each invocation of this method ServletOutputStream.isReady()must be called and must returntrueor theWriteListener.onWritePossible()call back must indicate that data may be written else anIllegalStateExceptionmust be thrown.Otherwise, if this method is called when bufferhas no data remaining, the method returns immediately andbufferis unchanged.If the output stream is in non-blocking mode, neither the position, limit nor content of the buffer passed to this method may be modified until a subsequent call to ServletOutputStream.isReady()returns true or theWriteListener.onWritePossible()call back indicates data may be written again. At this point the buffer's limit will be unchanged from the value when passed to this method and the position will be the same as the limit.If the output stream is in blocking mode and bufferhas space remaining, this method blocks until all the remaining data in the buffer has been written. When the method returns, and if data has been written, the buffer's limit will be unchanged from the value when passed to this method and the position will be the same as the limit.Subclasses are strongly encouraged to override this method and provide a more efficient implementation. - Overrides:
- writein class- ServletOutputStream
- Parameters:
- from- The buffer from which the data is written.
- Throws:
- IOException- If the output stream has been closed or if some other I/O error occurs.
 
- 
flushWill send the buffer to the client.- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException
 
- 
closeDescription copied from class:jakarta.servlet.ServletOutputStreamIf this method is called when the output stream is in non-blocking mode, it will immediately return with the stream effectively closed, even if the stream contains buffered data that is yet to be written to client. The container will write this data out in the background. If this process fails the WriteListener.onError(Throwable)method will be invoked as normal.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- ServletOutputStream
- Throws:
- IOException
 
- 
isReadypublic boolean isReady()Description copied from class:jakarta.servlet.ServletOutputStreamReturnstrueif it is allowable to call any method that may write data (e.g.write(),print()orflush). In blocking mode, this method will always returntrue, but a subsequent call to a method that writes data may block. In non-blocking mode this method may returnfalse, in which case it is illegal to call a method that writes data and anIllegalStateExceptionMUST be thrown. WhenWriteListener.onWritePossible()is called, a call to this method that returnedtrueis implicit.If this method returns falseand aWriteListenerhas been set viaServletOutputStream.setWriteListener(WriteListener), then container will subsequently invokeWriteListener.onWritePossible()once a write operation becomes possible without blocking. Other than the initial call,WriteListener.onWritePossible()will only be called if and only if this method is called and returns false.- Specified by:
- isReadyin class- ServletOutputStream
- Returns:
- trueif data can be written without blocking, otherwise returns- false.
 
- 
setWriteListenerDescription copied from class:jakarta.servlet.ServletOutputStreamSets theWriteListenerfor thisServletOutputStreamand 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:
- setWriteListenerin class- ServletOutputStream
- Parameters:
- listener- The non-blocking IO write listener
 
 
-