|
@@ -64,3 +64,44 @@ public class MuseumPictureServiceImpl implements MuseumPictureService {
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+//public void unzipAndAddToGroup(String groupId, String zipFilePath) throws IOException {
|
|
|
+// String photoGroupDir = "photos/" + groupId;
|
|
|
+// File groupDir = new File(photoGroupDir);
|
|
|
+// if (!groupDir.exists()) {
|
|
|
+// groupDir.mkdirs();
|
|
|
+// }
|
|
|
+//
|
|
|
+// unzip(zipFilePath, photoGroupDir);
|
|
|
+//}
|
|
|
+//
|
|
|
+//private void unzip(String zipFilePath, String destDir) throws IOException {
|
|
|
+// byte[] buffer = new byte[1024];
|
|
|
+// try (
|
|
|
+// FileInputStream fis = new FileInputStream(zipFilePath);
|
|
|
+// ZipInputStream zis = new ZipInputStream(fis)
|
|
|
+// ) {
|
|
|
+// ZipEntry zipEntry = zis.getNextEntry();
|
|
|
+// while (zipEntry != null) {
|
|
|
+// String filePath = destDir + File.separator + zipEntry.getName();
|
|
|
+// if (!zipEntry.isDirectory()) {
|
|
|
+// extractFile(zis, buffer, filePath);
|
|
|
+// } else {
|
|
|
+// File dir = new File(filePath);
|
|
|
+// dir.mkdir();
|
|
|
+// }
|
|
|
+// zis.closeEntry();
|
|
|
+// zipEntry = zis.getNextEntry();
|
|
|
+// }
|
|
|
+// zis.closeEntry();
|
|
|
+// }
|
|
|
+//}
|
|
|
+//
|
|
|
+//private void extractFile(ZipInputStream zis, byte[] buffer, String filePath) throws IOException {
|
|
|
+// try (FileOutputStream fos = new FileOutputStream(filePath)) {
|
|
|
+// int len;
|
|
|
+// while ((len = zis.read(buffer)) > 0) {
|
|
|
+// fos.write(buffer, 0, len);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|
|
|
+//}
|