public static final class MultipartBody.Builder
extends java.lang.Object
Part to MultipartBody.| Modifier and Type | Method and Description |
|---|---|
MultipartBody.Builder |
addPart(java.lang.String name,
java.io.File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String value)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
byte[] data)
Add bytes data to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
java.io.File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
java.io.InputStream data,
long contentLength)
Add a InputStream data to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
MediaType contentType,
byte[] data)
Add bytes data to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
MediaType contentType,
java.io.File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(java.lang.String name,
java.lang.String filename,
MediaType contentType,
java.io.InputStream data,
long contentLength)
Add a InputStream data to MultipartBody.
|
MultipartBody |
build()
Creates
MultipartBody from the provided parts. |
public MultipartBody.Builder addPart(java.lang.String name, java.io.File file)
name - Name of the parameter for file object to be passed in multipart requestfile - The file object to copy the content to FileUploadMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, java.io.File file)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filefile - The file object to copy the content to FileUploadMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, MediaType contentType, java.io.File file)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filecontentType - File content of type MediaType, possible values could be "text/plain", "application/json" etcfile - The file object to copy the content to FileUploadMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, byte[] data)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filedata - A byte Array (byte[]) representing the contents of the fileMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, MediaType contentType, byte[] data)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filecontentType - The content type of File, possible values could be "text/plain", "application/json" etcdata - A byte Array (byte[]) representing the contents of the fileMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, java.io.InputStream data, long contentLength)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filedata - An InputStream data value representing the content of file objectcontentLength - The size of the contentMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, MediaType contentType, java.io.InputStream data, long contentLength)
name - Name of the parameter for file object to be passed in multipart requestfilename - Name of the filecontentType - The content type of File, possible values could be "text/plain", "application/json" etcdata - An InputStream data value representing the content of file objectcontentLength - The size of the contentMultipartBody.Builder to build MultipartBodypublic MultipartBody.Builder addPart(java.lang.String name, java.lang.String value)
name - Name of the parameter or the key to be passed in multipart requestvalue - Plain String value for the parameterMultipartBody.Builder to build MultipartBodypublic MultipartBody build() throws MultipartException
MultipartBody from the provided parts.MultipartBodyMultipartException - If there are no parts