Apache Commons Compress 1.6版

[复制链接]
查看11 | 回复1 | 2014-2-19 11:55:14 | 显示全部楼层 |阅读模式
Apache Commons Compress 1.6 发布,该版本增加对 7z 压缩格式的支持;只读支持独立 LZMA 压缩文件和解压 arj 文件。
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);
}复制代码
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
http://commons.apache.org/proper/commons-compress/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行