final String newPath = "zip:" + slash1 + path + request.getFileName() + "!" + slash;
slash1 = "";
InputStream zipIn = null;
try {
zipIn = request.getSourceInputStream();
final ZipArchiveInputStream in = new ZipArchiveInputStream(zipIn);
try {
ZipArchiveEntry entry = null;
while ((entry = (ZipArchiveEntry) in.getNextZipEntry()) != null) {
final String name = entry.getName();
if (!entry.isDirectory()) {
final RequestMetaData metaData = new RequestMetaData(1L, 2L, name);
final RequestIdentifier identifier = new RequestIdentifier(uri);
final ZipEntryIdentificationRequest zipRequest =
new ZipEntryIdentificationRequest(metaData, identifier, tmpDir);
zipRequest.open(in);
final IdentificationResultCollection zipResults =
binarySignatureIdentifier.matchBinarySignatures(zipRequest);
final ResultPrinter resultPrinter =
new ResultPrinter(binarySignatureIdentifier,
containerSignatureDefinitions, newPath, slash, slash1, true);
resultPrinter.print(zipResults, zipRequest);
}
}
} finally {
if (in != null) {
in.close();
}
}
} catch (IOException ioe) {
System.err.println(ioe + " (" + newPath + ")"); // continue after corrupt archive
} finally {