If 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));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…