public class OkHttpResponseImpl extends Object implements HttpResponse
| 构造器和说明 |
|---|
OkHttpResponseImpl(okhttp3.Response response) |
| 限定符和类型 | 方法和说明 |
|---|---|
InputStream |
body()
获取响应主体
|
byte[] |
bodyAsBytes()
获取响应主体字节数组
|
String |
bodyAsString()
获取响应主体字符串
|
void |
close() |
int |
code()
获取响应代码
|
Charset |
contentEncoding()
获取内容编码
|
Long |
contentLength()
获取内容长度
|
String |
contentType()
获取内容类型
|
List<String> |
cookies()
获取小饼数组
|
String |
header(String name)
获取头值
|
Collection<String> |
headerNames()
获取头名
|
List<String> |
headers(String name)
获取头值数组
|
public Collection<String> headerNames()
HttpResponseheaderNames 在接口中 HttpResponsepublic String header(String name)
HttpResponseheader 在接口中 HttpResponsepublic List<String> headers(String name)
HttpResponseheaders 在接口中 HttpResponsepublic Long contentLength()
HttpResponsecontentLength 在接口中 HttpResponsepublic String contentType()
HttpResponsecontentType 在接口中 HttpResponsepublic Charset contentEncoding()
HttpResponsecontentEncoding 在接口中 HttpResponsepublic List<String> cookies()
HttpResponsecookies 在接口中 HttpResponsepublic int code()
HttpResponsecode 在接口中 HttpResponsepublic InputStream body()
HttpResponsebody 在接口中 HttpResponsepublic byte[] bodyAsBytes()
throws IOException
HttpResponsebodyAsBytes 在接口中 HttpResponseIOExceptionpublic String bodyAsString() throws IOException
HttpResponsebodyAsString 在接口中 HttpResponseIOExceptionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2024. All rights reserved.