use of cc.protea.util.http.BinaryResponse in project java-sdk by hyperwallet.
the class Request method readBinaryResponse.
/**
* A private method that handles reading the Responses from the server.
*
* @return a {@link Response} from the server.
* @throws IOException
*/
private BinaryResponse readBinaryResponse() throws IOException {
BinaryResponse response = new BinaryResponse();
response.setResponseCode(connection.getResponseCode());
response.setResponseMessage(connection.getResponseMessage());
response.setHeaders(connection.getHeaderFields());
try {
response.setBinaryBody(getBinaryFromStream(connection.getInputStream()));
} catch (IOException e) {
response.setBinaryBody(getBinaryFromStream(connection.getErrorStream()));
}
return response;
}
Aggregations