public abstract class RequestBody
extends java.lang.Object
| 构造器和说明 |
|---|
RequestBody() |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
content()
for get request byte string
|
long |
contentLength()
Returns the number of bytes that will be written to
out in a call to writeTo(com.meizu.cloud.pushsdk.networking.okio.BufferedSink),
or -1 if that count is unknown. |
abstract MediaType |
contentType()
Returns the Content-Type header for this body.
|
static RequestBody |
create(MediaType contentType,
byte[] content)
Returns a new request body that transmits
content. |
static RequestBody |
create(MediaType contentType,
byte[] content,
int offset,
int byteCount)
Returns a new request body that transmits
content. |
static RequestBody |
create(MediaType contentType,
ByteString content)
Returns a new request body that transmits
content. |
static RequestBody |
create(MediaType contentType,
java.io.File file)
Returns a new request body that transmits the content of
file. |
static RequestBody |
create(MediaType contentType,
java.lang.String content)
Returns a new request body that transmits
content. |
abstract void |
writeTo(BufferedSink sink)
Writes the content of this request to
out. |
public abstract MediaType contentType()
public long contentLength()
throws java.io.IOException
out in a call to writeTo(com.meizu.cloud.pushsdk.networking.okio.BufferedSink),
or -1 if that count is unknown.java.io.IOExceptionpublic abstract void writeTo(BufferedSink sink) throws java.io.IOException
out.java.io.IOExceptionpublic byte[] content()
public static RequestBody create(MediaType contentType, java.lang.String content)
content. If contentType is non-null
and lacks a charset, this will use UTF-8.public static RequestBody create(MediaType contentType, ByteString content)
content.public static RequestBody create(MediaType contentType, byte[] content)
content.public static RequestBody create(MediaType contentType, byte[] content, int offset, int byteCount)
content.public static RequestBody create(MediaType contentType, java.io.File file)
file.