From ebe6e77e2e1f741d49cf905147027dc9d0c53048 Mon Sep 17 00:00:00 2001 From: "fenghao (P)" Date: Mon, 12 Jul 2021 15:06:03 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I3MOQ1=20Description:=E5=BC=80?= =?UTF-8?q?=E6=BA=90=E6=95=B4=E6=94=B9=20Sig:aafwk=20Feature=20or=20Bugfix?= =?UTF-8?q?:=20Bugfig=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fenghao (P) --- adapter/ohos/Compressor.java | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index d8c9fc53..3b1487e5 100644 --- a/adapter/ohos/Compressor.java +++ b/adapter/ohos/Compressor.java @@ -965,43 +965,43 @@ public class Compressor { * compress pack.info * * @param sourceFile source - * @param zos ZipOutputStream + * @param zipOutputStream ZipOutputStream * @param name filename * @param KeepDirStructure Empty File */ - private void compress(File sourceFile, ZipOutputStream zos, String name, + private void compress(File sourceFile, ZipOutputStream zipOutputStream, String name, boolean KeepDirStructure) { FileInputStream in = null; try { byte[] buf = new byte[BUFFER_SIZE]; if (sourceFile.isFile()) { ZipEntry zipEntry = getStoredZipEntry(sourceFile, name); - zos.putNextEntry(zipEntry); + zipOutputStream.putNextEntry(zipEntry); in = new FileInputStream(sourceFile); int len; while ((len = in.read(buf)) != -1) { - zos.write(buf, 0, len); + zipOutputStream.write(buf, 0, len); } - zos.closeEntry(); + zipOutputStream.closeEntry(); } else { File[] listFiles = sourceFile.listFiles(); if (listFiles == null || listFiles.length == 0) { if (KeepDirStructure) { if (!name.isEmpty()) { ZipEntry zipEntry = getStoredZipEntry(sourceFile, name + "/"); - zos.putNextEntry(zipEntry); + zipOutputStream.putNextEntry(zipEntry); } else { ZipEntry zipEntry = getStoredZipEntry(sourceFile, name); - zos.putNextEntry(zipEntry); + zipOutputStream.putNextEntry(zipEntry); } - zos.closeEntry(); + zipOutputStream.closeEntry(); } } else { for (File file : listFiles) { if (KeepDirStructure) { - isNameEmpty(zos, name, KeepDirStructure, file); + isNameEmpty(zipOutputStream, name, KeepDirStructure, file); } else { - compress(file, zos, file.getName(), KeepDirStructure); + compress(file, zipOutputStream, file.getName(), KeepDirStructure); } } } @@ -1057,16 +1057,16 @@ public class Compressor { /** * isNameEmpty * - * @param zos ZipOutputStream + * @param zipOutputStream ZipOutputStream * @param name filename * @param KeepDirStructure KeepDirStructure * @param file file */ - private void isNameEmpty(ZipOutputStream zos, String name, boolean KeepDirStructure, File file) { + private void isNameEmpty(ZipOutputStream zipOutputStream, String name, boolean KeepDirStructure, File file) { if (!name.isEmpty()) { - compress(file, zos, name + "/" + file.getName(), KeepDirStructure); + compress(file, zipOutputStream, name + "/" + file.getName(), KeepDirStructure); } else { - compress(file, zos, file.getName(), KeepDirStructure); + compress(file, zipOutputStream, file.getName(), KeepDirStructure); } } -- Gitee