发布于 2014-10-11 03:26:26 | 491 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Apache Commons

Apache Commons项目的由三部分组成:The Commons Proper - 一个可重用的Java组件库。The Commons Sandbox - Java组件开发工作区. The Commons Dormant - 当前处于非活动状态的组件库.


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

 



历史版本 :
Apache Commons DBCP 2.2.0 发布
Apache Commons Pool 2.5.0 带来新特性和变更
Apache Commons Text 1.2,处理字符串的算法库
Apache Commons Lang 3.7 发布,Java 常用工具包
Apache Commons Compress 1.15 发布
Apache Commons VFS 2.2 发布,文件系统统一接口
Apache Commons JCS 2.2 发布,分布式缓存
Apache Commons CLI 1.4,Java 命令行参数处理类库
Apache Commons JCS 2.0 发布,分布式缓存
Apache Commons Compress 1.13 发布
Apache Commons Lang 3.5 发布
Apache Commons Weaver 1.3 发布
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务