public abstract class AsyncCharConsumer<T>
extends org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
HttpAsyncResponseConsumer
implementation that
provides convenience methods for processing of textual content entities enclosed
in an HTTP response.Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
bbuf |
private java.nio.CharBuffer |
cbuf |
private java.nio.charset.CharsetDecoder |
chardecoder |
Constructor and Description |
---|
AsyncCharConsumer() |
AsyncCharConsumer(int bufSize) |
Modifier and Type | Method and Description |
---|---|
protected java.nio.charset.CharsetDecoder |
createDecoder(org.apache.http.entity.ContentType contentType)
Invoked to create a @{link CharsetDecoder} for contentType.
|
private void |
handleDecodingResult(java.nio.charset.CoderResult result,
org.apache.http.nio.IOControl ioctrl) |
protected abstract void |
onCharReceived(java.nio.CharBuffer buf,
org.apache.http.nio.IOControl ioctrl)
Invoked to process a
chunk of content. |
protected void |
onContentReceived(org.apache.http.nio.ContentDecoder decoder,
org.apache.http.nio.IOControl ioctrl) |
protected void |
onEntityEnclosed(org.apache.http.HttpEntity entity,
org.apache.http.entity.ContentType contentType) |
protected void |
releaseResources() |
private final java.nio.ByteBuffer bbuf
private final java.nio.CharBuffer cbuf
private java.nio.charset.CharsetDecoder chardecoder
public AsyncCharConsumer(int bufSize)
public AsyncCharConsumer()
protected abstract void onCharReceived(java.nio.CharBuffer buf, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
chunk
of content.
The IOControl
interface can be used to suspend input events
if the consumer is temporarily unable to consume more content.buf
- chunk of content.ioctrl
- I/O control of the underlying connection.java.io.IOException
- in case of an I/O errorprotected java.nio.charset.CharsetDecoder createDecoder(org.apache.http.entity.ContentType contentType)
contentType
- response Content-Type or null if not specified.protected final void onEntityEnclosed(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType) throws java.io.IOException
onEntityEnclosed
in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
java.io.IOException
protected final void onContentReceived(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
onContentReceived
in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
java.io.IOException
private void handleDecodingResult(java.nio.charset.CoderResult result, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
java.io.IOException
protected void releaseResources()
releaseResources
in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>