Apache Commons Compress 1.7 发布

linux新闻评论583 views阅读模式

Apache Commons Compress 1.7 发布,此版本添加了 Snappy 只读支持和传统的 Unix.Z 压缩,同时还有一些 tar 和 7z 包的 bug 修复。源代码和二进制下载。

主要更新内容如下:
新特性:

o Read-Only support for Snappy compression.
Issue: COMPRESS-147. Thanks to BELUGA BEHR.
o Read-Only support for .Z compressed files.
Issue: COMPRESS-243. Thanks to Damjan Jovanovic.
o ZipFile and ZipArchiveInputStream now support reading entries
compressed using the SHRINKING method. Thanks to Damjan Jovanovic.
o GzipCompressorOutputStream now supports setting the compression
level and the header metadata (filename, comment, modification time,
operating system and extra flags)
Issue: COMPRESS-250. Thanks to Emmanuel Bourg.
o ZipFile and ZipArchiveInputStream now support reading entries
compressed using the IMPLODE method.
Issue: COMPRESS-115. Thanks to Emmanuel Bourg.
o ZipFile and the 7z file classes now implement Closeable and can be
used in try-with-resources constructs.

bug 修复:
o SevenZOutputFile#closeArchiveEntry throws an exception when using
LZMA2 compression on Java8. Issue: COMPRESS-241.
o 7z reading of big 64bit values could be wrong.
Issue: COMPRESS-244. Thanks to Nico Kruber.
o TarArchiveInputStream could fail to read an archive completely.
Issue: COMPRESS-245.
o The time-setters in X5455_ExtendedTimestamp now set the
corresponding flags explicitly - i.e. they set the bit if the valus
is not-null and reset it otherwise. This may cause
incompatibilities if you use setFlags to unset a bit and later set
the time to a non-null value - the flag will now be set.
Issue: COMPRESS-242.
o SevenZOutputFile would create invalid archives if more than six
empty files or directories were included. Issue: COMPRESS-252.

更多内容请看:http://commons.apache.org/compress/

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

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

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

企鹅博客
  • 本文由 发表于 2019年8月30日 16:44:15
  • 转载请务必保留本文链接:https://www.qieseo.com/283140.html

发表评论