java解压.zip或.jar文件java解压.zip或.jar文件
解压.zip或.jar文件(2007-06-18 10:47:12)
import java.io.*;
import java.util.zip.*;
public class ZipFileList {
public static void main(String[] args) {
extZipFileList("E:/software/lumaqq_2004-win32_x86_with_jre.zip", "E:/software/
");
}
private s...
java解压.zip或.jar文件
解压.zip或.jar文件(2007-06-18 10:47:12)
import java.io.*;
import java.util.zip.*;
public class ZipFileList {
public static void main(String[] args) {
extZipFileList("E:/software/lumaqq_2004-win32_x86_with_jre.zip", "E:/software/
");
}
private static void extZipFileList(String zipFileName, String extPlace) {
try {
ZipInputStream in = new ZipInputStream(new FileInputStream( zipFileName));
ZipEntry entry = null;
while ((entry = in.getNextEntry()) != null) {
String entryName = entry.getName();
if (entry.isDirectory()) {
File file = new File(extPlace entryName);
file.mkdirs();
System.out.println("创建文件夹:" entryName);
} else {
FileOutputStream os = new FileOutputStream(extPlace entryName);
// Transfer bytes from the ZIP file to the output file byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
os.write(buf, 0, len); }
os.close();
in.closeEntry();
}
}
} catch (IOException e) { }
System.out.println("解压文件成功");
}
}
但是不知道怎么才能解压.rar文件,求助中.......?????
本文档为【java解压.zip或.jar文件】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。