Java 类org.apache.http.nio.entity.ContentBufferEntity 实例源码

项目:elasticsearch_my    文件: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 + "]");
    }
    if (len < 0) {
        len = 4096;
    }
    this.buf = new SimpleInputBuffer((int) len, getByteBufferAllocator());
    this.response.setEntity(new ContentBufferEntity(entity, this.buf));
}
项目:aliyun-tablestore-java-sdk    文件:OTSAsyncResponseConsumer.java   
@Override
protected void onEntityEnclosed(final HttpEntity entity,
        final ContentType contentType) throws IOException {
    long len = entity.getContentLength();
    if (len > Integer.MAX_VALUE) {
        throw new ContentTooLongException("Entity content is too long: "
                + len);
    }
    if (len < 0) {
        len = BUFFER_SIZE;
    }
    this.buf = new SimpleInputBuffer((int) len,
            new HeapByteBufferAllocator());
    this.httpResponse.setEntity(new ContentBufferEntity(entity, this.buf));
}
项目:algorithmia-java    文件:HttpClientHelpers.java   
@Override
protected void onEntityEnclosed(final HttpEntity entity, final ContentType contentType) throws IOException {
    long len = entity.getContentLength();
    if (len > Integer.MAX_VALUE) {
        throw new ContentTooLongException("Entity content is too long: " + len);
    }
    if (len < 0) {
        len = 4096;
    }
    this.buf = new SimpleInputBuffer((int) len, new HeapByteBufferAllocator());
    this.response.setEntity(new ContentBufferEntity(entity, this.buf));
}