From 16aeffbb7b864335075aa7159e5a997b173b5f80 Mon Sep 17 00:00:00 2001 From: vempo Date: Wed, 10 Jan 2018 17:57:39 +0200 Subject: Removed addDir method which is not used Since this method is a package private method which is not used we decided to delete it. Change-Id: If2b303f97746b458b6d4c0e4e320fef3fc4962ae Issue-ID: SDC-886 Signed-off-by: vempo Signed-off-by: ya107f --- .../org/openecomp/core/tools/util/ZipUtils.java | 48 ++-------------------- 1 file changed, 4 insertions(+), 44 deletions(-) (limited to 'openecomp-be/tools/zusammen-tools/src/main') diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java index e0fd1a7535..96c7f17084 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java @@ -12,10 +12,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Objects; -import java.util.Scanner; -import java.util.Set; -import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; @@ -24,6 +20,10 @@ public class ZipUtils { private static final Logger logger = LoggerFactory.getLogger(ZipUtils.class); + private ZipUtils() { + // prevent instantiation + } + public static void createZip(String zipFileName, Path dir) throws IOException { File dirObj = dir.toFile(); Path zippedFile = Files.createFile(Paths.get(zipFileName)); @@ -41,46 +41,6 @@ public class ZipUtils { } } - public static final Set cleanStr(Set inFilterStrs) { - return inFilterStrs.stream().map(inFilterStr -> { - if (Objects.isNull(inFilterStr)) { - return inFilterStr; - } - Scanner scan = new Scanner(inFilterStr); - while (scan.hasNextLine()) { - inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", ""); - } - return inFilterStr; - } - ).collect(Collectors.toSet()); - } - - static void addDir(File dirObj, ZipOutputStream out, String root, Set filterItem) throws IOException { - File[] files = dirObj.listFiles(); - filterItem = cleanStr(filterItem); - - for (int i = 0; i < files.length; i++) { - if (files[i].isDirectory()) { - addDir(files[i], out, root, filterItem); - String filePath = files[i].getAbsolutePath().replace(root + File.separator, "") + File.separator; - out.putNextEntry(new ZipEntry(filePath)); - continue; - } - try (FileInputStream in = new FileInputStream((files[i].getAbsolutePath()))) { - String filePath = files[i].getAbsolutePath().replace(root + File.separator, ""); - if (filterItem.isEmpty() || filterItem.stream().anyMatch(s -> filePath.contains(s))) { - out.putNextEntry(new ZipEntry(filePath)); - try { - ByteStreams.copy(in, out); - } finally { - out.closeEntry(); - } - } - - } - } - } - public static void unzip(Path zipFile, Path outputFolder) throws IOException { if (zipFile == null || outputFolder == null) { return; -- cgit 1.2.3-korg