文件压缩/解压缩包 Apache Commons Compress 1.3 发布

jopen 12年前
     <p>Commons Compress 用以实现将文件压缩或解压成 tar、zip、bzip2 等格式。</p>    <p>下面代码将文件压缩成zip格式:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">Archive archiver = ArchiverFactory.getInstance("zip");                   archiver.add(   new File("C:\\Temp\\1.html"));                  archiver.add(   new File("C:\\Temp\\1.html.bz2"));                  archiver.save(  new File("C:\\Temp\\ZIPTEST.zip"));</pre>    <p>Zip文件的解压缩:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">Archive archiver = ArchiverFactory.getInstance(                                   new File("C:\\Temp\\ZIPTEST.zip"));                  archiver.unpack( new File("C:\\Temp\\unpacked\\"));</pre>Apache Commons Compress 1.3 发布了,该版本增加对 pack200 的支持,支持 Unix 的 dump 格式的只读处理,透明的对zip64扩展的支持,同时该版本也是 Compress 1.3 首次要求 Java 5 支持的版本。    <br />    <br /> 项目地址:    <a href="/misc/goto?guid=4958197391618676300" target="_blank">http://commons.apache.org/compress/</a>