Exemple #1
0
 /**
  * Return an {@code InputStream} for reading the decompressed contents of ZIP entry.
  *
  * @param ze the ZIP entry to be read.
  * @return the input stream to read from.
  * @throws IOException if an error occurred while creating the input stream.
  */
 @Override
 public InputStream getInputStream(ZipEntry ze) throws IOException {
   if (manifestEntry != null) {
     getManifest();
   }
   if (verifier != null) {
     verifier.setManifest(getManifest());
     if (manifest != null) {
       verifier.mainAttributesEnd = manifest.getMainAttributesEnd();
     }
     if (verifier.readCertificates()) {
       verifier.removeMetaEntries();
       if (manifest != null) {
         manifest.removeChunks();
       }
       if (!verifier.isSignedJar()) {
         verifier = null;
       }
     }
   }
   InputStream in = super.getInputStream(ze);
   if (in == null) {
     return null;
   }
   if (verifier == null || ze.getSize() == -1) {
     return in;
   }
   JarVerifier.VerifierEntry entry = verifier.initEntry(ze.getName());
   if (entry == null) {
     return in;
   }
   return new JarFileInputStream(in, ze, entry);
 }