try {
response = httpClientUtil.Get(httpClient, urlString, null, headers, cookies);
String tempStr = "";
GZIPInputStream gis1=null;
try {
gis1 = new GZIPInputStream(response.getEntity().getContent());
int len = -1;
byte [] b1 =new byte[1024];
ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
while((len = gis1.read(b1)) != -1){
bos1.write(b1, 0, len);
}
tempStr = bos1.toString("UTF-8");
// FileUtil fileUtil = new FileUtil();
// fileUtil.WriteString(tempStr,"D:/"+cityname+".txt");
//logger.info(cityname+"请求返回来的数据解压过后的字符串是:"+tempStr);
pm = this.getPmByHtml(tempStr);
} catch (Exception e) {
logger.error(cityname+"返回来的请求解压失败!",e);
}
}catch(Exception e){
logger.error(cityname+"请求出现异常",e);
}
http返回压缩包解压
http返回压缩包解压
最新推荐文章于 2022-07-12 16:30:16 发布