Package com.naver.ads.network.raw
Class AsyncHttpResponse
-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class AsyncHttpResponse extends HttpResponse
HTTP response to read response's body asynchronously.
AsyncHttpResponse implements Closeable, invoking Closeable.close will close the response body. The body must be closed by calling one of the following methods:
AsyncHttpResponse::close()
AsyncHttpResponse::getBody().close()
AsyncHttpResponse::getBodyAsByteArray()
AsyncHttpResponse.getBodyAsString()
AsyncHttpResponse.getBodyAsString(Charset)
-
-
Field Summary
Fields Modifier and Type Field Description private final HttpRequestrequestprivate final IntegerstatusCodeprivate final HttpHeadersheadersprivate final InputStreambody
-
Constructor Summary
Constructors Constructor Description AsyncHttpResponse(HttpRequest request, Integer statusCode, HttpHeaders headers, InputStream body)Constructs a new AsyncHttpResponse instance.
-
Method Summary
Modifier and Type Method Description HttpRequestgetRequest()the request which resulted in this response. IntegergetStatusCode()the response status code. HttpHeadersgetHeaders()the all response headers. final InputStreamgetBody()the response's content as a ByteArray. ByteArraygetBodyAsByteArray()Returns the response content as a ByteArray Unitclose()Closes the input stream assigned to this instance. -
-
Constructor Detail
-
AsyncHttpResponse
AsyncHttpResponse(HttpRequest request, Integer statusCode, HttpHeaders headers, InputStream body)
Constructs a new AsyncHttpResponse instance.
-
-
Method Detail
-
getRequest
HttpRequest getRequest()
the request which resulted in this response.
-
getStatusCode
Integer getStatusCode()
the response status code.
-
getHeaders
HttpHeaders getHeaders()
the all response headers.
-
getBody
final InputStream getBody()
the response's content as a ByteArray.
-
getBodyAsByteArray
ByteArray getBodyAsByteArray()
Returns the response content as a ByteArray
-
-
-
-