|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.impl.nio.codecs.AbstractContentEncoder
public abstract class AbstractContentEncoder
Abstract ContentEncoder
that serves as a base for all content
encoder implementations.
Field Summary | |
---|---|
protected SessionOutputBuffer |
buffer
|
protected WritableByteChannel |
channel
|
protected boolean |
completed
TODO: make private |
protected HttpTransportMetricsImpl |
metrics
|
Constructor Summary | |
---|---|
AbstractContentEncoder(WritableByteChannel channel,
SessionOutputBuffer buffer,
HttpTransportMetricsImpl metrics)
Creates an instance of this class. |
Method Summary | |
---|---|
protected void |
assertNotCompleted()
|
void |
complete()
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 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.http.nio.ContentEncoder |
---|
write |
Field Detail |
---|
protected final WritableByteChannel channel
protected final SessionOutputBuffer buffer
protected final HttpTransportMetricsImpl metrics
protected boolean completed
Constructor Detail |
---|
public AbstractContentEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, HttpTransportMetricsImpl 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.Method Detail |
---|
public boolean isCompleted()
ContentEncoder
true
if the entity has been transferred in its
entirety.
isCompleted
in interface ContentEncoder
true
if all the content has been produced,
false
otherwise.public void complete() throws IOException
ContentEncoder
complete
in interface ContentEncoder
IOException
- if I/O error occurs while writing contentprotected void assertNotCompleted()
protected int flushToChannel() throws IOException
IOException
protected int writeToChannel(ByteBuffer src) throws IOException
IOException
protected int writeToChannel(ByteBuffer src, int limit) throws IOException
src
- source.limit
- max number of bytes to transfer.
IOException
protected int writeToBuffer(ByteBuffer src, int limit) throws IOException
src
- source.limit
- max number of bytes to transfer.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |