final class BufferingClientHttpResponseWrapper extends java.lang.Object implements ClientHttpResponse
ClientHttpResponse
that reads the response's body
into memory, thus allowing for multiple invocations of getBody()
.Modifier and Type | Field and Description |
---|---|
private byte[] |
body |
private ClientHttpResponse |
response |
Constructor and Description |
---|
BufferingClientHttpResponseWrapper(ClientHttpResponse response) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this response, freeing any resources created.
|
java.io.InputStream |
getBody()
Return the body of the message as an input stream.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
int |
getRawStatusCode()
Return the HTTP status code (potentially non-standard and not
resolvable through the
HttpStatus enum) as an integer. |
HttpStatus |
getStatusCode()
Return the HTTP status code of the response.
|
java.lang.String |
getStatusText()
Return the HTTP status text of the response.
|
private final ClientHttpResponse response
@Nullable private byte[] body
BufferingClientHttpResponseWrapper(ClientHttpResponse response)
public HttpStatus getStatusCode() throws java.io.IOException
ClientHttpResponse
getStatusCode
in interface ClientHttpResponse
java.io.IOException
- in case of I/O errorsHttpStatus.valueOf(int)
public int getRawStatusCode() throws java.io.IOException
ClientHttpResponse
HttpStatus
enum) as an integer.getRawStatusCode
in interface ClientHttpResponse
java.io.IOException
- in case of I/O errorsClientHttpResponse.getStatusCode()
,
HttpStatus.resolve(int)
public java.lang.String getStatusText() throws java.io.IOException
ClientHttpResponse
getStatusText
in interface ClientHttpResponse
java.io.IOException
- in case of I/O errorspublic HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)public java.io.InputStream getBody() throws java.io.IOException
HttpInputMessage
getBody
in interface HttpInputMessage
null
)java.io.IOException
- in case of I/O errorspublic void close()
ClientHttpResponse
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface ClientHttpResponse