class ResponseHandlers {

    public static HttpClient.ResponseHandler<String> stringResponseHandler() {
        return (statusCode, responseBody, responseHeaders) -> {
            if (statusCode == 200) {
                return toString(responseBody, responseHeaders);
            }

            throw responseException(statusCode, new PushbackInputStream(responseBody), responseHeaders,
                ResponseHandlers::buildEmptyErrorResponse);
        };
    }

    private  ResponseHandlers();

}