All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.http.client.entity.ByteBufEntityBuilder Maven / Gradle / Ivy

Go to download

Log4j2 Appender plugin pushing logs in batches to Elasticsearch (2.x/5.x/6.x) clusters

There is a newer version: 1.6.1
Show newest version
package org.apache.http.client.entity;

import io.netty.buffer.ByteBuf;
import org.apache.http.HttpEntity;

/**
 * Custom {@code org.apache.http.client.entity.EntityBuilder} allows to create
 * {@code io.netty.buffer.ByteBuf}-based {@code org.apache.http.HttpEntity}
 */
public class ByteBufEntityBuilder extends EntityBuilder {

    private int contentLength = -1;
    private ByteBuf byteByf;

    public ByteBufEntityBuilder setContentLength(int contentLength) {
        this.contentLength = contentLength;
        return this;
    }

    public ByteBufEntityBuilder setByteBuf(ByteBuf byteBuf) {
        this.byteByf = byteBuf;
        return this;
    }

    @Override
    public HttpEntity build() {
        return new ByteBufHttpEntity(byteByf, contentLength, getContentType());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy