public class RawResponse extends Object implements AutoCloseable
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
void |
discardBody()
Consume and discard this response body
|
Collection<Cookie> |
getCookies()
Get all cookies
|
List<Cookie> |
getCookies(String name)
Get all cookies with name
|
Optional<Cookie> |
getFirstCookie(String name)
Get cookie with name
|
Optional<String> |
getFirstHeader(String name)
Get header value with name
|
List<net.dongliu.commons.collection.Pair<String,String>> |
getHeaders() |
List<String> |
getHeaders(String name)
Get all headers values with name
|
InputStream |
getIn()
The response body input stream
|
int |
getStatusCode()
The response status code
|
<T> T |
readAsJson(Class<T> cls)
Deserialize response content as json
|
<T> T |
readAsJson(Class<T> cls,
Charset charset)
Deserialize response content as json
|
<T> T |
readAsJson(Type type)
Deserialize response content as json
|
<T> T |
readAsJson(Type type,
Charset charset)
Deserialize response content as json
|
<T> T |
readAsJson(TypeInfer<T> typeInfer)
Deserialize response content as json
|
<T> T |
readAsJson(TypeInfer<T> typeInfer,
Charset charset)
Deserialize response content as json
|
byte[] |
readToBytes()
Read response body to byte array. return empty byte array if response has no body
|
String |
readToText()
Read response body to string. return empty string if response has no body
|
String |
readToText(Charset charset)
Read response body to string. return empty string if response has no body
|
void |
writeTo(OutputStream out)
Write response body to output stream.
|
void |
writeToFile(File path)
Write response body to file
|
public void close()
close 在接口中 AutoCloseablepublic String readToText()
public String readToText(Charset charset)
public byte[] readToBytes()
@Nullable public <T> T readAsJson(Type type, Charset charset)
@Nullable public <T> T readAsJson(Type type)
@Nullable public <T> T readAsJson(TypeInfer<T> typeInfer, Charset charset)
@Nullable public <T> T readAsJson(TypeInfer<T> typeInfer)
@Nullable public <T> T readAsJson(Class<T> cls, Charset charset)
@Nullable public <T> T readAsJson(Class<T> cls)
public void writeToFile(File path)
public void writeTo(OutputStream out)
public void discardBody()
public int getStatusCode()
public InputStream getIn()
public Collection<Cookie> getCookies()
Copyright © 2016. All rights reserved.