80,330
社区成员
发帖
与我相关
我的任务
分享
String data = EntityUtils.toString(response.getEntity(), "UTF-8" );
HttpEntity httpEntity = response.getEntity();
InputStream inputStream = null;
try {
inputStream = httpEntity.getContent();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
if (null == inputStream) {
return null;
}
String data = "";
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
if (null == br) {
return null;
}
StringBuffer buffer = new StringBuffer();
String line = null;
try {
while ((line = br.readLine()) != null) {
buffer.append(line).append("\n");
}
data = buffer.toString();
} catch (IOException e) {
e.printStackTrace();
}