gzip压缩

String data="aaaaaaaaaaaaaaaaaa";

byte[] b = data.getBytes();

ByteArrayOutputStream out = new ByteArrayOutputStream();  //带缓存的字节输出流

GZIPOutputStream gout = new GZIPOutputStream(out);

gour.write(b);

b = out.toByteArray();

response.setHeader("Content-Encoding", "gzip");                //通知客户端数据的压缩编码

response.setHeader("Content-Length", b.length+"");

response.getOutputStream().wwrite(b);

posted on 2015-03-26 09:58  颓废的悠然  阅读(137)  评论(0编辑  收藏  举报

导航