Response.CallBack| 构造器和说明 |
|---|
AbstractResponse(HttpURLConnection httpURLConnection) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acceptRanges()
是否支持分段下载
|
String |
body() |
byte[] |
bodyAsBytes()
返回字节数组
|
void |
bodyAsFile(Path file)
写入到文件里
|
com.alibaba.fastjson.JSONArray |
bodyAsJSONArray()
返回JSON数组
|
com.alibaba.fastjson.JSONObject |
bodyAsJSONObject()
返回JSON对象
|
BufferedInputStream |
bodyStream()
获取输入流
|
String |
charset()
获取编码格式
|
long |
contentLength()
获取大小
|
String |
contentType()
获取返回格式类型
|
HttpCookie |
cookie(String name)
获取Cookie信息
|
List<HttpCookie> |
cookieList() |
String |
filename()
获取文件名
|
boolean |
hasCookie(String name)
是否存在该Cookie
|
boolean |
hasCookieWithValue(String name,
String value)
是否存在该Cookie
|
boolean |
hasHeader(String name)
是否有该Header
|
boolean |
hasHeaderWithValue(String name,
String value)
是否存在该Header
|
String |
header(String name)
获取头部信息
|
Map<String,String> |
headers()
获取所有Header信息
|
com.alibaba.fastjson.JSONArray |
jsonpAsJSONArray()
解析jsonp返回JSON数组
|
com.alibaba.fastjson.JSONObject |
jsonpAsJSONObject()
解析jsonp返回JSON对象
|
Document |
parse() |
DocumentParser |
parser() |
ResponseMeta |
responseMeta()
获取返回元数据
|
int |
statusCode()
获取状态码
|
String |
statusMessage()
获取消息
|
String |
url()
获取返回网址
|
public AbstractResponse(HttpURLConnection httpURLConnection) throws IOException
IOExceptionpublic int statusCode()
ResponsestatusCode 在接口中 Responsepublic String statusMessage()
ResponsestatusMessage 在接口中 Responsepublic String contentType()
ResponsecontentType 在接口中 Responsepublic long contentLength()
ResponsecontentLength 在接口中 Responsepublic boolean acceptRanges()
ResponseacceptRanges 在接口中 Responsepublic boolean hasHeaderWithValue(String name, String value)
ResponsehasHeaderWithValue 在接口中 Responsepublic boolean hasCookieWithValue(String name, String value)
ResponsehasCookieWithValue 在接口中 Responsepublic HttpCookie cookie(String name)
Responsepublic List<HttpCookie> cookieList()
cookieList 在接口中 Responsepublic String body() throws IOException
body 在接口中 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(Path file) throws IOException
ResponsebodyAsFile 在接口中 ResponseIOExceptionpublic BufferedInputStream bodyStream()
ResponsebodyStream 在接口中 Responsepublic Document parse() throws IOException
parse 在接口中 ResponseIOExceptionpublic DocumentParser parser() throws IOException
parser 在接口中 ResponseIOExceptionpublic ResponseMeta responseMeta()
ResponseresponseMeta 在接口中 ResponseCopyright © 2020. All rights reserved.