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); } }