I'm who I am .

压缩GZip

上一篇 / 下一篇  2015-01-15 12:56:26 / 个人分类:java

    //----------------------------gZip--------------------------------------------------------
        /***
      * 压缩GZip
      *
      * @param data
      * @return
      */
     public static byte[] gZip(byte[] data) {
     System.out.println("压缩中。。。");
      byte[] b = null;
      try {
       ByteArrayOutputStream bos = new ByteArrayOutputStream();
       GZIPOutputStream gzip = new GZIPOutputStream(bos);
       gzip.write(data);
       gzip.finish();
       gzip.close();
       b = bos.toByteArray();
       bos.close();
      } catch (Exception ex) {
       ex.printStackTrace();
      }
      System.out.println("压缩完成。。。");
      return b;
     }

TAG:

 

评分:0

我来说两句

日历

« 2024-05-12  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 54590
  • 日志数: 51
  • 建立时间: 2015-01-04
  • 更新时间: 2015-05-27

RSS订阅

Open Toolbar