当前位置: 技术问答>linux和unix
我安装了Red Hat Enterprise Linux5为什么没有compress命令?
来源: 互联网 发布时间:2017-05-14
本文导语: 搞了好久 | Commons Compress 用以实现将文件压缩或解压成 tar、zip、bzip2 等格式。 下面代码将文件压缩成zip格式: Archive archiver = ArchiverFactory.getInstance("zip"); archiver.add( new...
搞了好久
|
Commons Compress 用以实现将文件压缩或解压成 tar、zip、bzip2 等格式。
下面代码将文件压缩成zip格式:
Archive archiver = ArchiverFactory.getInstance("zip");
archiver.add( new File("C:Temp1.html"));
archiver.add( new File("C:Temp1.html.bz2"));
archiver.save( new File("C:TempZIPTEST.zip"));
Zip文件的解压缩:
Archive archiver = ArchiverFactory.getInstance(
new File("C:TempZIPTEST.zip"));
archiver.unpack( new File("C:Tempunpacked"));
The Apache Commons Compress library defines an API for working with ar, cpio, Unix dump, tar, zip, gzip, Pack200 and bzip2 files.
The code in this component has many origins:
The bzip2, tar and zip support came from Avalon s Excalibur, but originally from Ant, as far as life in Apache goes. The tar package is originally Tim Endres public domain package. The bzip2 package is based on the work done by Keiron Liddle. It has migrated via:
Ant -> Avalon-Excalibur -> Commons-IO -> Commons-Compress.
下面代码将文件压缩成zip格式:
Archive archiver = ArchiverFactory.getInstance("zip");
archiver.add( new File("C:Temp1.html"));
archiver.add( new File("C:Temp1.html.bz2"));
archiver.save( new File("C:TempZIPTEST.zip"));
Zip文件的解压缩:
Archive archiver = ArchiverFactory.getInstance(
new File("C:TempZIPTEST.zip"));
archiver.unpack( new File("C:Tempunpacked"));
The Apache Commons Compress library defines an API for working with ar, cpio, Unix dump, tar, zip, gzip, Pack200 and bzip2 files.
The code in this component has many origins:
The bzip2, tar and zip support came from Avalon s Excalibur, but originally from Ant, as far as life in Apache goes. The tar package is originally Tim Endres public domain package. The bzip2 package is based on the work done by Keiron Liddle. It has migrated via:
Ant -> Avalon-Excalibur -> Commons-IO -> Commons-Compress.