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/Zip4jHelper.java |   45 +--------------------------------------------
 1 files changed, 1 insertions(+), 44 deletions(-)

diff --git a/src/main/java/com/moon/server/helper/Zip4jHelper.java b/src/main/java/com/moon/server/helper/Zip4jHelper.java
index a81e7f3..c6392e3 100644
--- a/src/main/java/com/moon/server/helper/Zip4jHelper.java
+++ b/src/main/java/com/moon/server/helper/Zip4jHelper.java
@@ -13,21 +13,10 @@
 import java.io.File;
 import java.nio.charset.StandardCharsets;
 
-/**
- * Zip4j甯姪绫�
- * @author WWW
- */
+@SuppressWarnings("ALL")
 public class Zip4jHelper {
     private final static Log log = LogFactory.getLog(Zip4jHelper.class);
 
-    /**
-     * Zip鍘嬬缉
-     *
-     * @param zipFile    zip鏂囦欢
-     * @param sourcePath 婧愯矾寰�
-     * @param pwd        瀵嗙爜
-     * @return 鎴愬姛鏄惁
-     */
     public static boolean zip(String zipFile, String sourcePath, String pwd) {
         try {
             ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray());
@@ -43,7 +32,6 @@
 
             ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd));
 
-            // 瑕佹墦鍖呯殑鏂囦欢鎴栨枃浠跺す
             File currentFile = new File(sourcePath);
             if (currentFile.isDirectory()) {
                 zip.addFolder(currentFile, params);
@@ -58,9 +46,6 @@
         }
     }
 
-    /**
-     * 鍒涘缓ZipFile
-     */
     public static ZipFile createZipFile(String zipFile, String pwd) {
         try {
             ZipFile zip = StringHelper.isEmpty(pwd) ? new ZipFile(zipFile) : new ZipFile(zipFile, pwd.toCharArray());
@@ -82,37 +67,20 @@
         }
     }
 
-    /**
-     * 鑾峰彇ZipParameters
-     */
     public static ZipParameters getZipParams(boolean hasPwd) {
-        // 璁剧疆鍘嬬缉鏂囦欢鍙傛暟
         ZipParameters params = new ZipParameters();
-        // 鍘嬬缉鏂瑰紡
         params.setCompressionMethod(CompressionMethod.DEFLATE);
-        // 鍘嬬缉绾у埆
         params.setCompressionLevel(CompressionLevel.MAXIMUM);
 
         if (hasPwd) {
-            // 鏄惁璁剧疆鍔犲瘑鏂囦欢
             params.setEncryptFiles(true);
-            // 璁剧疆AES鍔犲瘑寮哄害锛欿EY_STRENGTH_256
             params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128);
-            // 璁剧疆鍔犲瘑绠楁硶
             params.setEncryptionMethod(EncryptionMethod.AES);
         }
 
         return params;
     }
 
-    /**
-     * 娣诲姞鏂囦欢鑷冲帇缂╁寘
-     *
-     * @param zip    ZipFile
-     * @param params ZipParameters
-     * @param file   File
-     * @throws ZipException
-     */
     private static void addZipFile(ZipFile zip, ZipParameters params, File file) throws ZipException {
         if (file.isDirectory()) {
             File[] files = file.listFiles();
@@ -124,25 +92,14 @@
         }
     }
 
-    /**
-     * Zip瑙e帇
-     *
-     * @param zipFile  zip鏂囦欢
-     * @param toPath   瑙e帇璺緞
-     * @param password 瀵嗙爜
-     * @return 鎴愬姛鏄�/鍚�
-     */
     public static boolean unzip(String zipFile, String toPath, String password) {
         try {
-            // 鐢熸垚鐨勫帇缂╂枃浠�
             ZipFile zip = new ZipFile(zipFile);
 
-            // 璁剧疆瀵嗙爜
             if (!StringHelper.isEmpty(password)) {
                 zip.setPassword(password.toCharArray());
             }
 
-            // 瑙e帇缂╂墍鏈夋枃浠朵互鍙婃枃浠跺す
             zip.extractAll(toPath);
 
             return true;

--
Gitblit v1.9.3