Apache Commons Compress 1.17,bug 修复和新功能

栏目: 软件资讯 · 发布时间: 6年前

内容简介:Apache Commons Compress 1.17 已发布,和平时一样,该版本包含 bug 修复和新功能的引入。引入了一个新的接口 InputStreamStatistics,可用于监视由大多数压缩器和一些归档输入流(archiving input streams)实现的...

Apache Commons Compress 1.17 已发布,和平时一样,该版本包含 bug 修复和新功能的引入。引入了一个新的接口 InputStreamStatistics,可用于监视由大多数压缩器和一些归档输入流(archiving input streams)实现的解压进度。

下载地址:http://commons.apache.org/proper/commons-compress/download_compress.cgi

其它一些新特性

  • Added a unit test that is supposed to fail if we break the OSGi manifest entries again.

  • Add a new SkipShieldingInputStream class that can be used with streams that throw an IOException when skip is invoked.

  • New constructors have been added to SevenZFile that accept char[]s rather than byte[]s in order to avoid a common error of using the wrong encoding when creating the byte[]. This change may break source compatibility for client code that uses one of the constructors expecting a password and passes in null as password. We recommend to change the code to use a constructor without password argument.

详细更新内容点此查看

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);
}

【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

操作系统

操作系统

William Stallings / 陈向群、陈渝 / 机械工业出版社 / 2010.9 / 69.00元

本书不仅全面地讲述了操作系统的基本概念、原理和方法,还清楚地展现了当代操作系统的本质和特点。作者针对近几年操作系统领域的最新变化,对操作系统的设计原理进行深入的阐述,同时将其对操作系统整个领域全面而深入的理解呈现给读者。 本书特色 ·选择Windows Vista、UNIX和Linux三个操作系统作为示例,以帮助读者熟悉当代操作系统的设计原理和实现问题。 ·新增嵌入式操作系统一章......一起来看看 《操作系统》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换