Ich habe eine Multipart-Datei-Upload-Anfrage. Die Datei ist ein ZIP-Datei-ZIP-Format. Wie entzippe ich diese Datei? Ich muss eine Hashmap mit dem Dateipfad und Dateiinhalt jedes Eintrags füllen.. Zip-Datei hochladen Spring
HashMap<filepath, filecontent>
Der Code, den ich bisher habe:
FileInputStream fis = new FileInputStream(zipName);
ZipInputStream zis = new ZipInputStream(
new BufferedInputStream(fis));
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
int size;
byte[] buffer = new byte[2048];
FileOutputStream fos =
new FileOutputStream(entry.getName());
BufferedOutputStream bos =
new BufferedOutputStream(fos, buffer.length);
while ((size = zis.read(buffer, 0, buffer.length)) != -1) {
bos.write(buffer, 0, size);
}
bos.flush();
bos.close();
}
zis.close();
fis.close();
}