public abstract class RequestBody extends Object
| Constructor and Description |
|---|
RequestBody() |
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength()
返回调用
writeTo(org.aoju.bus.core.io.segment.BufferSink)时写入sink的字节数,如果该计数未知,则返回-1 |
abstract MediaType |
contentType() |
static RequestBody |
create(MediaType contentType,
byte[] content)
发送
content的新请求体 |
static RequestBody |
create(MediaType contentType,
byte[] content,
int offset,
int byteCount)
发送
content的新请求体 |
static RequestBody |
create(MediaType contentType,
ByteString content)
返回发送
content的新请求体 |
static RequestBody |
create(MediaType contentType,
File file)
新的请求体,该请求体传输
file的内容 |
static RequestBody |
create(MediaType contentType,
String content)
返回传输
content的新请求体。
如果contentType是非空且缺少字符集,则使用UTF-8 |
abstract void |
writeTo(BufferSink sink)
将此请求的内容写入
sink |
public static RequestBody create(MediaType contentType, String content)
content的新请求体。
如果contentType是非空且缺少字符集,则使用UTF-8contentType - 请求类型content - 内容public static RequestBody create(MediaType contentType, ByteString content)
content的新请求体contentType - 请求类型content - 内容public static RequestBody create(MediaType contentType, byte[] content)
content的新请求体contentType - 请求类型content - 内容public static RequestBody create(MediaType contentType, byte[] content, int offset, int byteCount)
content的新请求体contentType - 请求类型content - 内容offset - 偏移量byteCount - 当前大小public static RequestBody create(MediaType contentType, File file)
file的内容contentType - 请求类型file - 文件public abstract MediaType contentType()
public long contentLength()
throws IOException
writeTo(org.aoju.bus.core.io.segment.BufferSink)时写入sink的字节数,如果该计数未知,则返回-1IOException - 异常public abstract void writeTo(BufferSink sink) throws IOException
sinksink - 缓存区IOException - 异常信息Copyright © 2019. All rights reserved.