public abstract class AbstractContentEncoder extends Object implements ContentEncoder
ContentEncoder that serves as a base for all content
encoder implementations.| 构造器和说明 |
|---|
AbstractContentEncoder(WritableByteChannel channel,
SessionOutputBuffer buffer,
BasicHttpTransportMetrics metrics)
Creates an instance of this class.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
assertNotCompleted() |
protected SessionOutputBuffer |
buffer() |
protected WritableByteChannel |
channel() |
void |
complete() |
void |
complete(List<? extends Header> trailers)
Terminates the content stream.
|
protected int |
flushToChannel()
Flushes content of the session buffer to the channel and updates transport metrics.
|
boolean |
isCompleted()
Returns
true if the entity has been transferred in its
entirety. |
protected BasicHttpTransportMetrics |
metrics() |
protected int |
writeToBuffer(ByteBuffer src,
int limit)
Transfers content of the source to the buffer and updates transport metrics.
|
protected int |
writeToChannel(ByteBuffer src)
Flushes content of the given buffer to the channel and updates transport metrics.
|
protected int |
writeToChannel(ByteBuffer src,
int limit)
Transfers content of the source to the channel and updates transport metrics.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwritepublic AbstractContentEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics)
channel - the destination channel.buffer - the session output buffer that can be used to store
session data for intermediate processing.metrics - Transport metrics of the underlying HTTP transport.protected WritableByteChannel channel()
protected SessionOutputBuffer buffer()
protected BasicHttpTransportMetrics metrics()
public boolean isCompleted()
ContentEncodertrue if the entity has been transferred in its
entirety.isCompleted 在接口中 ContentEncodertrue if all the content has been produced,
false otherwise.public void complete(List<? extends Header> trailers) throws IOException
ContentEncodercomplete 在接口中 ContentEncoderIOException - if I/O error occurs while writing contentpublic final void complete()
throws IOException
IOExceptionprotected void assertNotCompleted()
protected int flushToChannel()
throws IOException
IOExceptionprotected int writeToChannel(ByteBuffer src) throws IOException
IOExceptionprotected int writeToChannel(ByteBuffer src, int limit) throws IOException
src - source.limit - max number of bytes to transfer.IOExceptionprotected int writeToBuffer(ByteBuffer src, int limit) throws IOException
src - source.limit - max number of bytes to transfer.IOExceptionCopyright © 2023. All rights reserved.