|
@@ -4,21 +4,27 @@ import java.awt.Color;
|
|
import java.awt.Point;
|
|
import java.awt.Point;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
|
|
+import java.io.FileOutputStream;
|
|
import java.io.FileReader;
|
|
import java.io.FileReader;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
+import java.io.OutputStream;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Files;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.zip.ZipException;
|
|
import java.util.zip.ZipException;
|
|
|
|
+import java.util.zip.ZipInputStream;
|
|
|
|
|
|
import org.apache.commons.compress.archivers.ArchiveEntry;
|
|
import org.apache.commons.compress.archivers.ArchiveEntry;
|
|
import org.apache.commons.compress.archivers.ArchiveException;
|
|
import org.apache.commons.compress.archivers.ArchiveException;
|
|
import org.apache.commons.compress.archivers.ArchiveInputStream;
|
|
import org.apache.commons.compress.archivers.ArchiveInputStream;
|
|
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
|
|
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
|
|
|
|
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
|
|
|
+import org.apache.commons.compress.utils.IOUtils;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.GsonBuilder;
|
|
import com.google.gson.GsonBuilder;
|
|
@@ -108,6 +114,9 @@ public class LoadController {
|
|
File src = new File(path);
|
|
File src = new File(path);
|
|
File folder = readArchive(path, src);
|
|
File folder = readArchive(path, src);
|
|
folder.deleteOnExit();
|
|
folder.deleteOnExit();
|
|
|
|
+ for (File file : Arrays.asList(folder.listFiles())) {
|
|
|
|
+ System.out.println(file.getName());
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -129,15 +138,24 @@ public class LoadController {
|
|
|
|
|
|
private File readArchive(String path, File src) throws IOException, ArchiveException {
|
|
private File readArchive(String path, File src) throws IOException, ArchiveException {
|
|
File tmp = Files.createTempDirectory("tmpHolon").toFile();
|
|
File tmp = Files.createTempDirectory("tmpHolon").toFile();
|
|
-
|
|
|
|
|
|
+ tmp.deleteOnExit();
|
|
InputStream input = new FileInputStream(src);
|
|
InputStream input = new FileInputStream(src);
|
|
ArchiveInputStream stream = new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.ZIP,
|
|
ArchiveInputStream stream = new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.ZIP,
|
|
input);
|
|
input);
|
|
|
|
|
|
ArchiveEntry entry = stream.getNextEntry();
|
|
ArchiveEntry entry = stream.getNextEntry();
|
|
while (entry != null) {
|
|
while (entry != null) {
|
|
|
|
+ File file = new File(tmp, entry.getName());
|
|
|
|
+ file.getParentFile().mkdirs();
|
|
|
|
+ OutputStream output = new FileOutputStream(file);
|
|
|
|
+ IOUtils.copy(stream, output);
|
|
|
|
+ output.close();
|
|
|
|
+ // file.createNewFile();
|
|
entry = stream.getNextEntry();
|
|
entry = stream.getNextEntry();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ stream.close();
|
|
|
|
+ input.close();
|
|
|
|
|
|
return tmp;
|
|
return tmp;
|
|
}
|
|
}
|