org.apache.hc.client5.http.entity.mime

## Class MultipartEntityBuilder

- java.lang.Object
- - org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder

-     public class MultipartEntityBuilder
      extends Object

  Builder for multipart `HttpEntity`s.
  Since:
    5.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MultipartEntityBuilder` | `addBinaryBody(String name, byte[] b)`
    `MultipartEntityBuilder` | `addBinaryBody(String name, byte[] b, org.apache.hc.core5.http.ContentType contentType, String filename)`
    `MultipartEntityBuilder` | `addBinaryBody(String name, File file)`
    `MultipartEntityBuilder` | `addBinaryBody(String name, File file, org.apache.hc.core5.http.ContentType contentType, String filename)`
    `MultipartEntityBuilder` | `addBinaryBody(String name, InputStream stream)`
    `MultipartEntityBuilder` | `addBinaryBody(String name, InputStream stream, org.apache.hc.core5.http.ContentType contentType, String filename)`
    `MultipartEntityBuilder` | `addEpilogue(String epilogue)` Adds an epilogue to the multipart entity being constructed.
    `MultipartEntityBuilder` | `addParameter(org.apache.hc.core5.http.message.BasicNameValuePair parameter)` Add parameter to the current `ContentType`.
    `MultipartEntityBuilder` | `addPart(MultipartPart multipartPart)`
    `MultipartEntityBuilder` | `addPart(String name, ContentBody contentBody)`
    `MultipartEntityBuilder` | `addPreamble(String preamble)` Adds a preamble to the multipart entity being constructed.
    `MultipartEntityBuilder` | `addTextBody(String name, String text)`
    `MultipartEntityBuilder` | `addTextBody(String name, String text, org.apache.hc.core5.http.ContentType contentType)`
    `org.apache.hc.core5.http.HttpEntity` | `build()`
    `static MultipartEntityBuilder` | `create()`
    `MultipartEntityBuilder` | `setBoundary(String boundary)`
    `MultipartEntityBuilder` | `setCharset(Charset charset)`
    `MultipartEntityBuilder` | `setContentType(org.apache.hc.core5.http.ContentType contentType)`
    `MultipartEntityBuilder` | `setLaxMode()`
    `MultipartEntityBuilder` | `setMimeSubtype(String subType)`
    `MultipartEntityBuilder` | `setMode(HttpMultipartMode mode)`
    `MultipartEntityBuilder` | `setStrictMode()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static MultipartEntityBuilder create()

    - #### setMode

          public MultipartEntityBuilder setMode(HttpMultipartMode mode)

    - #### setLaxMode

          public MultipartEntityBuilder setLaxMode()

    - #### setStrictMode

          public MultipartEntityBuilder setStrictMode()

    - #### setBoundary

          public MultipartEntityBuilder setBoundary(String boundary)

    - #### setMimeSubtype

          public MultipartEntityBuilder setMimeSubtype(String subType)

      Since:
        4.4

    - #### setContentType

          public MultipartEntityBuilder setContentType(org.apache.hc.core5.http.ContentType contentType)

      Since:
        4.5

    - #### addParameter

          public MultipartEntityBuilder addParameter(org.apache.hc.core5.http.message.BasicNameValuePair parameter)

      Add parameter to the current `ContentType`.
      Parameters:
        `parameter` - The name-value pair parameter to add to the `ContentType`.
      Returns:
        the `MultipartEntityBuilder` instance.
      Since:
        5.2

    - #### setCharset

          public MultipartEntityBuilder setCharset(Charset charset)

    - #### addPart

          public MultipartEntityBuilder addPart(MultipartPart multipartPart)

      Since:
        4.4

    - #### addPart

          public MultipartEntityBuilder addPart(String name,
                                                ContentBody contentBody)

    - #### addTextBody

          public MultipartEntityBuilder addTextBody(String name,
                                                    String text,
                                                    org.apache.hc.core5.http.ContentType contentType)

    - #### addTextBody

          public MultipartEntityBuilder addTextBody(String name,
                                                    String text)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      byte[] b,
                                                      org.apache.hc.core5.http.ContentType contentType,
                                                      String filename)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      byte[] b)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      File file,
                                                      org.apache.hc.core5.http.ContentType contentType,
                                                      String filename)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      File file)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      InputStream stream,
                                                      org.apache.hc.core5.http.ContentType contentType,
                                                      String filename)

    - #### addBinaryBody

          public MultipartEntityBuilder addBinaryBody(String name,
                                                      InputStream stream)

    - #### addPreamble

          public MultipartEntityBuilder addPreamble(String preamble)

      Adds a preamble to the multipart entity being constructed. The preamble is the text that appears before the first boundary delimiter. The preamble is optional and may be null.
      Parameters:
        `preamble` - The preamble text to add to the multipart entity
      Returns:
        This MultipartEntityBuilder instance, to allow for method chaining
      Since:
        5.3

    - #### addEpilogue

          public MultipartEntityBuilder addEpilogue(String epilogue)

      Adds an epilogue to the multipart entity being constructed. The epilogue is the text that appears after the last boundary delimiter. The epilogue is optional and may be null.
      Parameters:
        `epilogue` - The epilogue text to add to the multipart entity
      Returns:
        This MultipartEntityBuilder instance, to allow for method chaining
      Since:
        5.3

    - #### build

          public org.apache.hc.core5.http.HttpEntity build()

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.