com.sinch.sdk.core.http.HttpResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.core.http;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class HttpResponse {
private final int code;
private final String message;
private final Map> headers;
private final byte[] buffer;
public HttpResponse(
final int code,
final String message,
final Map> headers,
final byte[] buffer) {
this.code = code;
this.message = null != message ? message : "";
this.headers = (null != headers) ? headers : Collections.emptyMap();
this.buffer = null != buffer ? buffer : "".getBytes(StandardCharsets.UTF_8);
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public Map> getHeaders() {
return headers;
}
public InputStream getContent() {
return new ByteArrayInputStream(buffer);
}
@Override
public String toString() {
return "HttpResponse{"
+ "code="
+ code
+ ", message='"
+ message
+ '\''
+ ", headers="
+ headers
+ ", buffer="
+ new String(buffer)
+ '}';
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy