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

com.imperva.shcf4j.request.body.multipart.ByteArrayPartBuilder Maven / Gradle / Ivy

Go to download

The Simple HTTP Client Facade for Java (SHCF4J) serves as a simple facade or abstraction for various HTTP client frameworks (e.g. java.net.HttpURLConnection, Apache HttpClient, etc.) allowing the end user to plug in the desired HTTP client framework at deployment time.

The newest version!
package com.imperva.shcf4j.request.body.multipart;

import com.imperva.shcf4j.entity.ContentType;

import java.util.Arrays;
import java.util.Objects;

public class ByteArrayPartBuilder extends PartBuilder {

    protected byte[] bytes;

    ByteArrayPartBuilder() {
        contentType(ContentType.createApplicationOctetStream());
    }

    public ByteArrayPartBuilder bytes(byte[] bytes){
        Objects.requireNonNull(bytes, "bytes");
        this.bytes = Arrays.copyOf(bytes, bytes.length);
        return this;
    }

    @Override
    public Part build() {
        Objects.requireNonNull(bytes, "bytes");
        return new ByteArrayPart(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy