public abstract class RequestBody extends Object
| Constructor and Description |
|---|
RequestBody()
|
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength()
Returns the number of bytes that will be written to
out in a call to
writeTo(okio.BufferedSink), or -1 if that count is unknown.
|
abstract MediaType |
contentType()
Returns the Content-Type header for this body.
|
static RequestBody |
create(MediaType
Returns a new request body that transmits
content.
|
static RequestBody |
create(MediaType
Returns a new request body that transmits
content.
|
static RequestBody |
create(MediaType
Returns a new request body that transmits
content.
|
static RequestBody |
create(MediaType
Returns a new request body that transmits the content of
file.
|
static RequestBody |
create(MediaType
Returns a new request body that transmits
content.
|
abstract void |
writeTo(okio
Writes the content of this request to
out.
|
public abstract MediaTypecontentType()
public long contentLength()
throws IOException
out in a call to
writeTo(okio.BufferedSink), or -1 if that count is unknown.
IOException
public abstract void writeTo(okio.BufferedSink sink) throws IOException
out.
IOException
public static RequestBodycreate(MediaType contentType, String content)
content. If
contentType is non-null and lacks a charset, this will use UTF-8.
public static RequestBodycreate(MediaType contentType, okio .ByteString content)
content.
public static RequestBodycreate(MediaType contentType, byte[] content)
content.
public static RequestBodycreate(MediaType contentType, byte[] content, int offset, int byteCount)
content.
public static RequestBodycreate(MediaType contentType, File file)
file.