public interface HttpCodec
| Modifier and Type | Field and Description |
|---|---|
static int |
DISCARD_STREAM_TIMEOUT_MILLIS
丢弃输入数据流时要使用的超时。由于这是用于连接重用,
因此此超时时间应该大大少于建立新连接所需的时间.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
取消这个流。这个流所持有的资源将被清理,尽管不是同步的。这可能会在连接池线程之后发生
|
Sink |
createRequestBody(Request request,
long contentLength)
返回一个可以对请求体进行流处理的输出流.
|
void |
finishRequest()
将请求刷新到基础套接字,就不会传输更多的字节.
|
void |
flushRequest()
将请求刷新到基础套接字.
|
ResponseBody |
openResponseBody(Response response)
返回读取响应体的流.
|
Response.Builder |
readResponseHeaders(boolean expectContinue)
从HTTP传输解析响应头的字节
|
void |
writeRequestHeaders(Request request)
这应该更新HTTP引擎的sentRequestMillis字段.
|
static final int DISCARD_STREAM_TIMEOUT_MILLIS
Sink createRequestBody(Request request, long contentLength)
request - 网络请求contentLength - 内容长度void writeRequestHeaders(Request request) throws IOException
request - 网络请求IOException - 异常void flushRequest()
throws IOException
IOException - 异常void finishRequest()
throws IOException
IOException - 异常Response.Builder readResponseHeaders(boolean expectContinue) throws IOException
expectContinue - 如果这是一个带有“100”响应代码的中间响应,
则返回null。否则,此方法永远不会返回null.IOException - 异常ResponseBody openResponseBody(Response response) throws IOException
response - 响应IOException - 异常void cancel()
Copyright © 2019. All rights reserved.