http返回压缩包解压

来源:互联网 发布:淘宝店经营技巧 编辑:程序博客网 时间:2024/05/16 00:39
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返回压缩包解压
0 0
原创粉丝点击