From 024e90554d19c2342f27a26f91bbea378f84da82 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 13 十一月 2024 17:25:18 +0800 Subject: [PATCH] 1 --- src/main/java/com/moon/server/helper/ZipHelper.java | 39 +-------------------------------------- 1 files changed, 1 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/moon/server/helper/ZipHelper.java b/src/main/java/com/moon/server/helper/ZipHelper.java index 9b1ce99..8e09629 100644 --- a/src/main/java/com/moon/server/helper/ZipHelper.java +++ b/src/main/java/com/moon/server/helper/ZipHelper.java @@ -10,10 +10,7 @@ import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; -/** - * Zip甯姪绫� - * @author WWW - */ +@SuppressWarnings("ALL") public class ZipHelper { private final static int BUFFER_SIZE = 1024; @@ -21,13 +18,6 @@ private final static Log log = LogFactory.getLog(ZipHelper.class); - /** - * Zip瑙e帇 - * - * @param filePath zip鏂囦欢 - * @param zipDir 瑙e帇璺緞 - * @return 鎴愬姛鏄�/鍚� - */ public static boolean unzip(String filePath, String zipDir) { ZipFile zipFile = null; try { @@ -55,9 +45,6 @@ } } - /** - * 鍒涘缓鐩綍 - */ private static void createDirs(ZipFile zipFile, String zipDir) { Enumeration<?> e = zipFile.entries(); while (e.hasMoreElements()) { @@ -71,9 +58,6 @@ } } - /** - * 鍐欐枃浠� - */ private static void writeFiles(ZipFile zipFile, String zipDir) throws IOException { Enumeration<?> e = zipFile.entries(); while (e.hasMoreElements()) { @@ -84,9 +68,6 @@ } } - /** - * 鍐欐枃浠� - */ private static void writeFile(ZipFile zipFile, ZipEntry entry, String zipDir) throws IOException { int count; @@ -103,13 +84,6 @@ is.close(); } - /** - * Zip鍘嬬缉 - * - * @param zipFile zip婧愭枃浠� - * @param sourceDir 婧愭枃浠跺す - * @return 鎴愬姛鏄�/鍚� - */ public static boolean zip(String zipFile, String sourceDir) { FileOutputStream fos = null; ZipOutputStream zos = null; @@ -138,20 +112,10 @@ } } - /** - * Zip鍘嬬缉 - * - * @param sourceFile zip婧愭枃浠� - * @param zos zip杈撳嚭娴� - * @param name zip鏂囦欢鍚嶇О - * @throws Exception - */ public static void compress(File sourceFile, ZipOutputStream zos, String name) throws Exception { if (sourceFile.isFile()) { - // 鍚憐ip杈撳嚭娴佷腑娣诲姞涓�涓獄ip瀹炰綋锛屾瀯閫犲櫒涓璶ame涓簔ip瀹炰綋鐨勬枃浠剁殑鍚嶅瓧 zos.putNextEntry(new ZipEntry(name)); - // copy鏂囦欢鍒皕ip杈撳嚭娴佷腑 int len; FileInputStream in = new FileInputStream(sourceFile); while ((len = in.read(BUFFER)) != -1) { @@ -162,7 +126,6 @@ } else { File[] listFiles = sourceFile.listFiles(); if (listFiles == null || listFiles.length == 0) { - // 绌烘枃浠跺す鐨勫鐞嗭細娌℃湁鏂囦欢锛屼笉闇�瑕佹枃浠剁殑copy zos.putNextEntry(new ZipEntry(name + "/")); zos.closeEntry(); } else { -- Gitblit v1.9.3