
com.lindzh.jetcd.HttpResponseMeta Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jetcd Show documentation
Show all versions of jetcd Show documentation
Jetcd is a java etcd v2 client
The newest version!
package com.lindzh.jetcd;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
public class HttpResponseMeta {
private int statusCode;
private String encode;
private byte[] response;
private String contentType;
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public String getEncode() {
return encode;
}
public void setEncode(String encode) {
this.encode = encode;
}
public String getResponseAsString() {
if (response != null) {
if (encode != null) {
try {
return new String(response, encode);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
} else {
return new String(response);
}
} else {
return null;
}
}
public long getResponseSize(){
return response.length;
}
public InputStream getResponseAsInputStream(){
return new ByteArrayInputStream(response);
}
public void setResponse(byte[] response) {
this.response = response;
}
public byte[] getResponseAsBytes() {
return response;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy