⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unzip.java

📁 DSS数字签名
💻 JAVA
字号:
package zipfile;
import java.io.*;

import java.util.zip.*;
public class Unzip {
	public static void UnZip(String unzipfile) {
		try {
			File olddirec = new File(unzipfile); //解压缩的文件路径(为了获取路径)
			ZipInputStream zin = new ZipInputStream(new FileInputStream(unzipfile));
			ZipEntry entry;
			//创建文件夹
			while ( (entry = zin.getNextEntry()) != null){
				if (entry.isDirectory()) {
					File directory = new File(olddirec.getParent(), entry.getName());
					if (!directory.exists())
						if (!directory.mkdirs())
							System.exit(0);
					zin.closeEntry();
				}
				if (!entry.isDirectory()) {
					File myFile = new File(entry.getName());
					FileOutputStream fout = new FileOutputStream("D:\\soft\\YSF\\"+myFile.getPath());
					DataOutputStream dout = new DataOutputStream(fout);
					byte[] b = new byte[1024];
					int len = 0;
					while ( (len = zin.read(b)) != -1) {
						dout.write(b, 0, len);
					}
					dout.close();
					fout.close();
					zin.closeEntry();
				}
			}
		}
		catch (IOException e) {
			e.printStackTrace();
			System.out.println(e);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -