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 RequestBody
public long contentLength() throws IOException
RequestBody
out
in a call to RequestBody.writeTo(okio.BufferedSink)
,
or -1 if that count is unknown.contentLength
in class RequestBody
IOException
public void writeTo(okio.BufferedSink sink) throws IOException
RequestBody
out
.writeTo
in class RequestBody
IOException
Copyright © 2017. All Rights Reserved.