Removed addDir method which is not used 11/27811/3
authorvempo <vitaliy.emporopulo@amdocs.com>
Wed, 10 Jan 2018 15:57:39 +0000 (17:57 +0200)
committerAvi Gaffa <avi.gaffa@amdocs.com>
Thu, 11 Jan 2018 12:23:22 +0000 (12:23 +0000)
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 <vitaliy.emporopulo@amdocs.com>
Signed-off-by: ya107f <ya107f@intl.att.com>
openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java

index e0fd1a7..96c7f17 100644 (file)
@@ -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<String> cleanStr(Set<String> 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<String> 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;