| 构造器和说明 |
|---|
ResponseImpl(RequestMeta requestMeta,
ResponseMeta responseMeta,
ClientConfig clientConfig) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acceptRanges()
是否支持分段下载
|
String |
body()
返回字符串
|
byte[] |
bodyAsBytes()
返回字节数组
|
void |
bodyAsFile(Path file)
将输入流写入到指定文件
若文件已存在,则会追加到文件尾部
|
void |
bodyAsFile(String filePath)
将输入流写入到指定文件
若文件已存在,则会追加到文件尾部
|
com.alibaba.fastjson.JSONArray |
bodyAsJSONArray()
返回JSON数组
|
com.alibaba.fastjson.JSONObject |
bodyAsJSONObject()
返回JSON对象
|
InputStream |
bodyStream()
获取输入流
|
String |
charset()
获取编码格式
|
String |
contentEncoding()
获取contentEncoding头部信息,若不存在则返回null
|
long |
contentLength()
获取大小
|
String |
contentType()
获取返回格式类型
|
void |
disconnect()
断开连接
|
String |
filename()
获取文件名
|
boolean |
hasCookie(String name)
是否存在指定Cookie
|
boolean |
hasCookie(String name,
String value)
是否存在指定Cookie
|
boolean |
hasHeader(String name)
是否有该Header
|
boolean |
hasHeader(String name,
String value)
是否存在该Header
|
List<String> |
header(String name)
获取头部信息
|
Map<String,List<String>> |
headers()
获取所有Header信息
|
com.alibaba.fastjson.JSONArray |
jsonpAsJSONArray()
解析jsonp返回JSON数组
|
com.alibaba.fastjson.JSONObject |
jsonpAsJSONObject()
解析jsonp返回JSON对象
|
Response |
maxDownloadSpeed(int maxDownloadSpeed)
设置最大下载速率(kb/s)
|
Document |
parse()
解析成DOM数并返回Document对象
|
DocumentParser |
parser()
使用事件监听机制获取处理DOM树
|
ResponseMeta |
responseMeta()
获取返回元数据
|
int |
statusCode()
获取状态码
|
String |
statusMessage()
获取状态说明
|
String |
url()
获取返回地址
|
public ResponseImpl(RequestMeta requestMeta, ResponseMeta responseMeta, ClientConfig clientConfig)
public int statusCode()
ResponsestatusCode 在接口中 Responsepublic String statusMessage()
ResponsestatusMessage 在接口中 Responsepublic String contentType()
ResponsecontentType 在接口中 Responsepublic long contentLength()
ResponsecontentLength 在接口中 Responsepublic boolean acceptRanges()
ResponseacceptRanges 在接口中 Responsepublic String contentEncoding()
ResponsecontentEncoding 在接口中 Responsepublic Response maxDownloadSpeed(int maxDownloadSpeed)
ResponsemaxDownloadSpeed 在接口中 Responsepublic String body() throws IOException
Responsebody 在接口中 ResponseIOExceptionpublic com.alibaba.fastjson.JSONObject bodyAsJSONObject()
throws IOException
ResponsebodyAsJSONObject 在接口中 ResponseIOExceptionpublic com.alibaba.fastjson.JSONArray bodyAsJSONArray()
throws IOException
ResponsebodyAsJSONArray 在接口中 ResponseIOExceptionpublic com.alibaba.fastjson.JSONObject jsonpAsJSONObject()
throws IOException
ResponsejsonpAsJSONObject 在接口中 ResponseIOExceptionpublic com.alibaba.fastjson.JSONArray jsonpAsJSONArray()
throws IOException
ResponsejsonpAsJSONArray 在接口中 ResponseIOExceptionpublic byte[] bodyAsBytes()
throws IOException
ResponsebodyAsBytes 在接口中 ResponseIOExceptionpublic void bodyAsFile(String filePath) throws IOException
Response若文件已存在,则会追加到文件尾部
bodyAsFile 在接口中 ResponseIOExceptionpublic void bodyAsFile(Path file) throws IOException
Response若文件已存在,则会追加到文件尾部
bodyAsFile 在接口中 ResponseIOExceptionpublic InputStream bodyStream()
ResponsebodyStream 在接口中 Responsepublic Document parse() throws IOException
Responseparse 在接口中 ResponseIOExceptionpublic DocumentParser parser() throws IOException
Responseparser 在接口中 ResponseIOExceptionpublic void disconnect()
Responsedisconnect 在接口中 Responsepublic ResponseMeta responseMeta()
ResponseresponseMeta 在接口中 ResponseCopyright © 2021. All rights reserved.