|
@@ -167,23 +167,24 @@ public class Zip4jUtil {
|
|
|
if (!file.exists()) {
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
+ ZipParameters parameters = new ZipParameters();
|
|
|
+ // 压缩方法
|
|
|
+ parameters.setCompressionMethod(CompressionMethod.DEFLATE);
|
|
|
+ // 压缩级别
|
|
|
+ parameters.setCompressionLevel(CompressionLevel.NORMAL);
|
|
|
// 生成的压缩文件
|
|
|
ZipFile zipFile;
|
|
|
password = null;
|
|
|
if (Objects.nonNull(password)) {
|
|
|
+ parameters.setEncryptFiles(true);
|
|
|
+ parameters.setEncryptionMethod(EncryptionMethod.AES);
|
|
|
+ parameters.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_256);
|
|
|
zipFile = new ZipFile(scrPath, password.toCharArray());
|
|
|
} else {
|
|
|
zipFile = new ZipFile(scrPath);
|
|
|
}
|
|
|
|
|
|
- ZipParameters parameters = new ZipParameters();
|
|
|
- // 压缩方法
|
|
|
- parameters.setCompressionMethod(CompressionMethod.DEFLATE);
|
|
|
- // 压缩级别
|
|
|
- parameters.setCompressionLevel(CompressionLevel.NORMAL);
|
|
|
- parameters.setEncryptFiles(true);
|
|
|
- parameters.setEncryptionMethod(EncryptionMethod.AES);
|
|
|
- parameters.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_256);
|
|
|
+
|
|
|
|
|
|
// 3. 添加文件夹到zip
|
|
|
File folderToAdd = new File(destPath);
|