I have zip file which is inside a folder in zip file please suggest me how to read it using zip input stream.
E.G.:
abc.zip
|
documents/bcd.zip
How to read a zip file inside zip file?
See Question&Answers more detail:osI have zip file which is inside a folder in zip file please suggest me how to read it using zip input stream.
E.G.:
abc.zip
|
documents/bcd.zip
How to read a zip file inside zip file?
See Question&Answers more detail:osIf you want to look through zip files within zip files recursively,
public void lookupSomethingInZip(InputStream fileInputStream) throws IOException {
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
String entryName = "";
ZipEntry entry = zipInputStream.getNextEntry();
while (entry!=null) {
entryName = entry.getName();
if (entryName.endsWith("zip")) {
//recur if the entry is a zip file
lookupSomethingInZip(zipInputStream);
}
//do other operation with the entries..
entry=zipInputStream.getNextEntry();
}
}
Call the method with the file input stream derived from the file -
File file = new File(name);
lookupSomethingInZip(new FileInputStream(file));