You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
846 B

package com.fr.plugin.third.party.jsdjjed.util.http;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
/**
* @Author xx
* @Date 2020/9/15
* @Description
**/
public class HttpResponseStringPraser implements HttpResponsePraser<HttpResponseString> {
@Override
public HttpResponseString prase(HttpResultCode resultCode, int httpCode, Map<String, String> headers, List<String> cookies, String charSet, ByteArrayOutputStream outputStream) {
String st = null;
try {
if(outputStream != null){
byte[] resultBytes = outputStream.toByteArray();
st = new String(resultBytes, charSet);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return new HttpResponseString(resultCode, httpCode, headers, cookies, charSet, st);
}
}