List of usage examples for org.apache.http.nio.entity ContentBufferEntity ContentBufferEntity
public ContentBufferEntity(final HttpEntity entity, final ContentInputBuffer buffer)
From source file:org.elasticsearch.client.HeapBufferedAsyncResponseConsumer.java
@Override protected void onEntityEnclosed(HttpEntity entity, ContentType contentType) throws IOException { long len = entity.getContentLength(); if (len > bufferLimitBytes) { throw new ContentTooLongException("entity content is too long [" + len + "] for the configured buffer limit [" + bufferLimitBytes + "]"); }/*from w ww . j a v a 2 s .c om*/ if (len < 0) { len = 4096; } this.buf = new SimpleInputBuffer((int) len, getByteBufferAllocator()); this.response.setEntity(new ContentBufferEntity(entity, this.buf)); }