Class BufferedHttpResponse
- java.lang.Object
-
- com.azure.android.core.http.HttpResponse
-
- com.azure.android.core.http.implementation.BufferedHttpResponse
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public final class BufferedHttpResponse extends HttpResponse
HTTP response which will buffer the response's body.
-
-
Constructor Summary
Constructors Constructor Description BufferedHttpResponse(HttpResponse innerHttpResponse)Creates a buffered HTTP response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedHttpResponsebuffer()Get a new Response object wrapping this response with it's content buffered into memory.voidclose()Closes the response content stream, if any.java.io.InputStreamgetBody()Get theInputStreamproducing response content chunks.byte[]getBodyAsByteArray()Get the response content as a byte[].java.lang.StringgetBodyAsString()Get the response content as a string.java.lang.StringgetBodyAsString(java.nio.charset.Charset charset)Get the response content as a string.HttpHeadersgetHeaders()Get all response headers.java.lang.StringgetHeaderValue(java.lang.String name)Lookup a response header with the provided name.intgetStatusCode()Get the response status code.-
Methods inherited from class com.azure.android.core.http.HttpResponse
getRequest
-
-
-
-
Constructor Detail
-
BufferedHttpResponse
public BufferedHttpResponse(HttpResponse innerHttpResponse)
Creates a buffered HTTP response.- Parameters:
innerHttpResponse- The HTTP response to buffer.
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Description copied from class:HttpResponseGet the response status code.- Specified by:
getStatusCodein classHttpResponse- Returns:
- the response status code
-
getHeaderValue
public java.lang.String getHeaderValue(java.lang.String name)
Description copied from class:HttpResponseLookup a response header with the provided name.- Specified by:
getHeaderValuein classHttpResponse- Parameters:
name- the name of the header to lookup.- Returns:
- the value of the header, or null if the header doesn't exist in the response.
-
getHeaders
public HttpHeaders getHeaders()
Description copied from class:HttpResponseGet all response headers.- Specified by:
getHeadersin classHttpResponse- Returns:
- the response headers
-
getBody
public java.io.InputStream getBody()
Description copied from class:HttpResponseGet theInputStreamproducing response content chunks.- Specified by:
getBodyin classHttpResponse- Returns:
- The response's content as a stream.
-
getBodyAsByteArray
public byte[] getBodyAsByteArray()
Description copied from class:HttpResponseGet the response content as a byte[].- Specified by:
getBodyAsByteArrayin classHttpResponse- Returns:
- this response content as a byte[]
-
getBodyAsString
public java.lang.String getBodyAsString()
Description copied from class:HttpResponseGet the response content as a string.- Specified by:
getBodyAsStringin classHttpResponse- Returns:
- This response content as a string
-
getBodyAsString
public java.lang.String getBodyAsString(java.nio.charset.Charset charset)
Description copied from class:HttpResponseGet the response content as a string.- Specified by:
getBodyAsStringin classHttpResponse- Parameters:
charset- the charset to use as encoding- Returns:
- This response content as a string
-
buffer
public BufferedHttpResponse buffer()
Description copied from class:HttpResponseGet a new Response object wrapping this response with it's content buffered into memory.- Overrides:
bufferin classHttpResponse- Returns:
- the new Response object
-
close
public void close()
Description copied from class:HttpResponseCloses the response content stream, if any.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classHttpResponse
-
-