使用命令行参数从Zip文件中提取文件
import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException;/* 来 自 nowjava*/ import java.io.OutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { public static void main(String args[]) { String strZipFile = "z.zip"; String strDestinationPath = "text"; try { FileInputStream fin = new FileInputStream(strZipFile); ZipInputStream zin = new ZipInputStream(fin);/**来 自 时 代 J a v a**/ ZipEntry entry = zin.getNextEntry(); OutputStream os = new FileOutputStream(strDestinationPath + "/" + entry.getName()); byte[] buffer = new byte[1024]; int length; while ((length = zin.read(buffer)) > 0) { os.write(buffer, 0, length); } os.close();