Package arc.util
Class Http.HttpResponse
java.lang.Object
arc.util.Http.HttpResponse
- Enclosing class:
- Http
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns a Map of the headers.byte[]
Returns the data of the HTTP response as a byte[].Returns the data of the HTTP response as anInputStream
.Returns the data of the HTTP response as aString
.
-
Constructor Details
-
HttpResponse
- Throws:
IOException
-
-
Method Details
-
getContentLength
public long getContentLength()- Returns:
- the length of received content in bytes as a long. May throw an exception (?)
-
getResult
public byte[] getResult()Returns the data of the HTTP response as a byte[].Note: This method may only be called once per response.
- Returns:
- the result as a byte[] or null in case of a timeout or if the operation was canceled/terminated abnormally. The
timeout is specified when creating the HTTP request, with
Http.HttpRequest.timeout(int)
-
getResultAsString
Returns the data of the HTTP response as aString
.Note: This method may only be called once per response.
- Returns:
- the result as a string or null in case of a timeout or if the operation was canceled/terminated abnormally. The
timeout is specified when creating the HTTP request, with
Http.HttpRequest.timeout(int)
-
getResultAsStream
Returns the data of the HTTP response as anInputStream
.
Warning: Do not store a reference to this InputStream. The underlying HTTP connection will be closed after that callback finishes executing. Reading from the InputStream after it's connection has been closed will lead to exception.- Returns:
- An
InputStream
with theHttp.HttpResponse
data.
-
getStatus
- Returns:
- the
Http.HttpStatus
containing the statusCode of the HTTP response.
-
getHeader
- Returns:
- the value of the header with the given name as a
String
, or null if the header is not set.
-
getHeaders
Returns a Map of the headers. The keys are Strings that represent the header name. Each values is a List of Strings that represent the corresponding header values.
-