public static final class MultipartBody.Builder extends Object
Part
to MultipartBody
.Modifier and Type | Method and Description |
---|---|
MultipartBody.Builder |
addPart(String name,
File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String value)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
byte[] data)
Add bytes data to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
InputStream data,
long contentLength)
Add a InputStream data to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
MediaType contentType,
byte[] data)
Add bytes data to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
MediaType contentType,
File file)
Add a file object to MultipartBody.
|
MultipartBody.Builder |
addPart(String name,
String filename,
MediaType contentType,
InputStream data,
long contentLength)
Add a InputStream data to MultipartBody.
|
MultipartBody |
build()
Creates
MultipartBody from the provided parts. |
public MultipartBody.Builder addPart(String name, File file)
name
- Name of the parameter for file object to be passed in multipart requestfile
- The file object to copy the content to FileUpload
MultipartBody.Builder
to build MultipartBodypublic MultipartBody.Builder addPart(String name, String filename, 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 FileUpload
MultipartBody.Builder
to build MultipartBodypublic MultipartBody.Builder addPart(String name, String filename, MediaType contentType, 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 FileUpload
MultipartBody.Builder
to build MultipartBodypublic MultipartBody.Builder addPart(String name, 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(String name, 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(String name, String filename, 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 content to pass to HttpDataFactory
in order to create
FileUpload
objectMultipartBody.Builder
to build MultipartBodypublic MultipartBody.Builder addPart(String name, String filename, MediaType contentType, 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 content to pass to HttpDataFactory
in order to create
FileUpload
objectMultipartBody.Builder
to build MultipartBodypublic MultipartBody.Builder addPart(String name, 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.MultipartBody
MultipartException
- If there are no parts