aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/zusammen-tools/src
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2018-01-10 17:57:39 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-01-11 12:23:22 +0000
commit16aeffbb7b864335075aa7159e5a997b173b5f80 (patch)
tree3e72d7900e053b284fbcbbd0f5c7faae9a5e1beb /openecomp-be/tools/zusammen-tools/src
parent9582973589fdb08f9e5869be13eadd171ed06598 (diff)
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 <vitaliy.emporopulo@amdocs.com> Signed-off-by: ya107f <ya107f@intl.att.com>
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java48
1 files changed, 4 insertions, 44 deletions
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<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;