private class UndertowServerHttpResponse.ResponseBodyProcessor extends AbstractListenerWriteProcessor<DataBuffer>
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
byteBuffer |
private StreamSinkChannel |
channel |
logger
Constructor and Description |
---|
ResponseBodyProcessor(StreamSinkChannel channel) |
Modifier and Type | Method and Description |
---|---|
protected void |
dataReceived(DataBuffer dataBuffer)
Template method invoked after a data item to write is received via
Subscriber#onNext(Object) . |
protected boolean |
isDataEmpty(DataBuffer dataBuffer)
Whether the given data item has any content to write.
|
protected boolean |
isWritePossible()
Whether writing is possible.
|
protected boolean |
write(DataBuffer dataBuffer)
Write the given item.
|
private int |
writeByteBuffer(java.nio.ByteBuffer byteBuffer) |
protected void |
writingComplete()
Invoked after onComplete or onError notification.
|
protected void |
writingFailed(java.lang.Throwable ex)
Invoked when an I/O error occurs during a write.
|
protected void |
writingPaused()
Invoked after the current data has been written and before requesting
the next item from the upstream, write Publisher.
|
cancel, onComplete, onError, onNext, onSubscribe, onWritePossible, subscribe
private final StreamSinkChannel channel
@Nullable private volatile java.nio.ByteBuffer byteBuffer
protected boolean isWritePossible()
AbstractListenerWriteProcessor
isWritePossible
in class AbstractListenerWriteProcessor<DataBuffer>
protected boolean write(DataBuffer dataBuffer) throws java.io.IOException
AbstractListenerWriteProcessor
Note: Sub-classes are responsible for releasing any data buffer associated with the item, once fully written, if pooled buffers apply to the underlying container.
write
in class AbstractListenerWriteProcessor<DataBuffer>
dataBuffer
- the item to writetrue
), or or otherwise if more writes are required.java.io.IOException
private int writeByteBuffer(java.nio.ByteBuffer byteBuffer) throws java.io.IOException
java.io.IOException
protected void dataReceived(DataBuffer dataBuffer)
AbstractListenerWriteProcessor
Subscriber#onNext(Object)
. The default implementation saves the
data item for writing once that is possible.dataReceived
in class AbstractListenerWriteProcessor<DataBuffer>
protected boolean isDataEmpty(DataBuffer dataBuffer)
AbstractListenerWriteProcessor
isDataEmpty
in class AbstractListenerWriteProcessor<DataBuffer>
protected void writingPaused()
AbstractListenerWriteProcessor
The default implementation is a no-op.
writingPaused
in class AbstractListenerWriteProcessor<DataBuffer>
protected void writingComplete()
AbstractListenerWriteProcessor
The default implementation is a no-op.
writingComplete
in class AbstractListenerWriteProcessor<DataBuffer>
protected void writingFailed(java.lang.Throwable ex)
AbstractListenerWriteProcessor
Defaults to no-op.
writingFailed
in class AbstractListenerWriteProcessor<DataBuffer>