List of usage examples for org.apache.http.nio ContentDecoder read
int read(ByteBuffer dst) throws IOException;
From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java
@Override public synchronized void consumeContent(final ContentDecoder decoder, final IOControl ioctrl) throws IOException { if (this.log.isDebugEnabled()) { this.log.debug("[exchange: " + this.id + "] Consume content"); }/*from w w w.jav a2s .c om*/ if (this.finalResponse != null) { this.responseConsumer.consumeContent(decoder, ioctrl); } else { if (this.tmpbuf == null) { this.tmpbuf = ByteBuffer.allocate(2048); } this.tmpbuf.clear(); decoder.read(this.tmpbuf); } }
From source file:org.apache.http.impl.nio.client.MainClientExec.java
@Override public void consumeContent(final InternalState state, final ContentDecoder decoder, final IOControl ioctrl) throws IOException { if (this.log.isDebugEnabled()) { this.log.debug("[exchange: " + state.getId() + "] Consume content"); }/*from www . j a va 2s .c o m*/ if (state.getFinalResponse() != null) { final HttpAsyncResponseConsumer<?> responseConsumer = state.getResponseConsumer(); responseConsumer.consumeContent(decoder, ioctrl); } else { final ByteBuffer tmpbuf = state.getTmpbuf(); tmpbuf.clear(); decoder.read(tmpbuf); } }