Search in sources :

Example 1 with BinaryResponse

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;
}
Also used : BinaryResponse(cc.protea.util.http.BinaryResponse) IOException(java.io.IOException)

Aggregations

BinaryResponse (cc.protea.util.http.BinaryResponse)1 IOException (java.io.IOException)1