public class OkHttpResponse extends Object implements Response
Response 响应包装| 构造器和说明 |
|---|
OkHttpResponse(okhttp3.Response rawRes,
Charset requestCharset) |
| 限定符和类型 | 方法和说明 |
|---|---|
InputStream |
bodyStream()
获得服务区响应流
流获取后处理完毕需关闭此类 |
Charset |
charset()
获取字符集编码,默认为响应头中的编码
|
void |
close() |
int |
getStatus()
获取状态码
|
String |
header(String name)
根据name获取头信息
根据RFC2616规范,header的name不区分大小写 |
Map<String,List<String>> |
headers()
获取headers
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbody, bodyBytes, bodyStr, contentEncoding, contentLength, getCookieStr, header, isChunked, isOk, thenpublic OkHttpResponse(okhttp3.Response rawRes,
Charset requestCharset)
rawRes - ResponserequestCharset - 请求时的默认编码public String header(String name)
Responsepublic InputStream bodyStream()
ResponsebodyStream 在接口中 Responsepublic void close()
close 在接口中 Closeableclose 在接口中 AutoCloseableCopyright © 2023. All rights reserved.