forked from fanruan/finekit
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.
22 lines
743 B
22 lines
743 B
6 years ago
|
package com.fanruan.api.net.http;
|
||
|
|
||
|
import com.fr.third.org.apache.http.HttpEntity;
|
||
|
import com.fr.third.org.apache.http.ParseException;
|
||
|
import com.fr.third.org.apache.http.util.EntityUtils;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
public class EntityKit {
|
||
|
/**
|
||
|
* 利用defaultCharset字符集将HttpEntity对象转化为String对象
|
||
|
* @param entity 需要转化为String的HttpEntity对象
|
||
|
* @param defaultCharset 传入的字符集
|
||
|
* @return HttpEntity对象转化为的String对象
|
||
|
* @throws IOException
|
||
|
* @throws ParseException
|
||
|
*/
|
||
|
public static String toString(HttpEntity entity, String defaultCharset) throws IOException, ParseException {
|
||
|
return EntityUtils.toString(entity, defaultCharset);
|
||
|
}
|
||
|
}
|