public final class MultipartBody extends RequestBody
| Modifier and Type | Class and Description |
|---|---|
static class |
MultipartBody.Builder |
static class |
MultipartBody.Part |
| Modifier and Type | Field and Description |
|---|---|
static MediaType |
ALTERNATIVE
The "multipart/alternative" type is syntactically identical to "multipart/mixed", but the
semantics are different.
|
static MediaType |
DIGEST
This type is syntactically identical to "multipart/mixed", but the semantics are different.
|
static MediaType |
FORM
The media-type multipart/form-data follows the rules of all multipart MIME data streams as
outlined in RFC 2046.
|
static MediaType |
MIXED
The "mixed" subtype of "multipart" is intended for use when the body parts are independent and
need to be bundled in a particular order.
|
static MediaType |
PARALLEL
This type is syntactically identical to "multipart/mixed", but the semantics are different.
|
| Modifier and Type | Method and Description |
|---|---|
String |
boundary() |
long |
contentLength()
Returns the number of bytes that will be written to
out in a call to RequestBody.writeTo(okio.BufferedSink),
or -1 if that count is unknown. |
MediaType |
contentType()
A combination of
type() and boundary(). |
MultipartBody.Part |
part(int index) |
List<MultipartBody.Part> |
parts() |
int |
size()
The number of parts in this multipart body.
|
MediaType |
type() |
void |
writeTo(okio.BufferedSink sink)
Writes the content of this request to
out. |
public static final MediaType MIXED
public static final MediaType ALTERNATIVE
public static final MediaType DIGEST
Content-Type value for a body part is changed from
"text/plain" to "message/rfc822".public static final MediaType PARALLEL
public static final MediaType FORM
public MediaType type()
public String boundary()
public int size()
public List<MultipartBody.Part> parts()
public MultipartBody.Part part(int index)
public MediaType contentType()
type() and boundary().contentType in class RequestBodypublic long contentLength()
throws IOException
RequestBodyout in a call to RequestBody.writeTo(okio.BufferedSink),
or -1 if that count is unknown.contentLength in class RequestBodyIOExceptionpublic void writeTo(okio.BufferedSink sink)
throws IOException
RequestBodyout.writeTo in class RequestBodyIOExceptionCopyright © 2017. All Rights Reserved.