final class HttpEntityBody extends RequestBody
HttpEntity
to OkHttp's RequestBody
.Modifier and Type | Field and Description |
---|---|
private static MediaType |
DEFAULT_MEDIA_TYPE |
private org.apache.http.HttpEntity |
entity |
private MediaType |
mediaType |
Constructor and Description |
---|
HttpEntityBody(org.apache.http.HttpEntity entity,
java.lang.String contentTypeHeader) |
Modifier and Type | Method and Description |
---|---|
long |
contentLength()
Returns the number of bytes that will be written to
sink in a call to RequestBody.writeTo(okio.BufferedSink) ,
or -1 if that count is unknown. |
MediaType |
contentType()
Returns the Content-Type header for this body.
|
void |
writeTo(okio.BufferedSink sink)
Writes the content of this request to
sink . |
private static final MediaType DEFAULT_MEDIA_TYPE
private final org.apache.http.HttpEntity entity
private final MediaType mediaType
HttpEntityBody(org.apache.http.HttpEntity entity, java.lang.String contentTypeHeader)
public long contentLength()
RequestBody
sink
in a call to RequestBody.writeTo(okio.BufferedSink)
,
or -1 if that count is unknown.contentLength
in class RequestBody
public MediaType contentType()
RequestBody
contentType
in class RequestBody
public void writeTo(okio.BufferedSink sink) throws java.io.IOException
RequestBody
sink
.writeTo
in class RequestBody
java.io.IOException