你好,游客 登录 注册 搜索
背景:
阅读新闻

Apache Commons Compress 1.9 发布下载

[日期:2014-10-11] 来源:oschina.net  作者:Linux [字体:大 中 小]

Apache Commons Compress 1.9 发布,此版本现已提供下载,在没有 GZIP 的情况下支持原始压缩流;修复了 7z 和 tar 包相关的 bug;改进了对 Java 库 XZ 的检测。

更新内容如下:

新特性
o Added support for DEFLATE streams without any gzip framing.
  Issue: COMPRESS-263.
  Thanks to Matthias Stevens.

Bugs 修复
o When reading 7z files unknown file properties and properties of type
  kDummy are now ignored.
  Issue: COMPRESS-287.
o Expanding 7z archives using LZMA compression could cause an
  EOFException.
  Issue: COMPRESS-286. 
o Long-Name and -link or PAX-header entries in TAR archives always had
  the current time as last modfication time, creating archives that
  are different at the byte level each time an archive was built.
  Issue: COMPRESS-289.
  Thanks to Bob Robertson.

改进
o Checking for XZ for Java may be expensive.  The result will now be
  cached outside of an OSGi environment.  You can use the new
  XZUtils#setCacheXZAvailability to overrride this default behavior.
  Issue: COMPRESS-285.

Commons Compress 用以实现将文件压缩或解压成 tar、zip、bzip2 等格式。

下面代码将文件压缩成zip格式:

ArArchiveEntry entry = new ArArchiveEntry(name, size);
arOutput.putArchiveEntry(entry);
arOutput.write(contentOfEntry);
arOutput.closeArchiveEntry();

Zip文件的解压缩:

ArArchiveEntry entry = (ArArchiveEntry) arInput.getNextEntry();
byte[] content = new byte[entry.getSize()];
LOOP UNTIL entry.getSize() HAS BEEN READ {
    arInput.read(content, offset, content.length - offset);
}

Commons Compress 的详细介绍:请点这里
Commons Compress 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/107885.htm

linux
相关资讯       Commons Compress 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款