private void parseEntries(ArchiveInputStream ais, Metadata metadata,
                              EmbeddedDocumentExtractor extractor, XHTMLContentHandler xhtml,
                              boolean shouldUseDataDescriptor, AtomicInteger entryCnt)
            throws TikaException, IOException, SAXException {
        try {
            ArchiveEntry entry = ais.getNextEntry();
            while (entry != null) {
                if (shouldUseDataDescriptor && entryCnt.get() > 0) {
                    // With shouldUseDataDescriptor being true, we are reading
                    // the zip once again. The number of entryCnt entries have
                    // already been parsed in the last time, so we can just
                    // skip these entries.
                    entryCnt.decrementAndGet();
                    entry = ais.getNextEntry();
                    continue;
                }

                if (!entry.isDirectory()) {
                    parseEntry(ais, entry, extractor, metadata, xhtml);
                }

                if (!shouldUseDataDescriptor) {
                    // Record the number of entries we have read, this is used
                    // for zip archives using Data Descriptor. It's used for
                    // skipping the entries we have already read
                    entryCnt.incrementAndGet();
                }

                entry = ais.getNextEntry();
            }
        } catch (UnsupportedZipFeatureException zfe) {

            // If it's an encrypted document of unknown password, report as such
            if (zfe.getFeature() == Feature.ENCRYPTION) {
                throw new EncryptedDocumentException(zfe);
            }

            if (zfe.getFeature() == Feature.DATA_DESCRIPTOR) {
                throw zfe;
            }
            // Otherwise throw the exception
            throw new TikaException("UnsupportedZipFeature", zfe);
        } catch (PasswordRequiredException pre) {
            throw new EncryptedDocumentException(pre);
        }
    }
Parse the entries of the zip archive

@param ais                     archive input stream
@param metadata                document metadata (input and output)
@param extractor               the delegate parser
@param xhtml                   the xhtml handler
@param shouldUseDataDescriptor indicates if a data descriptor is required or not
@param entryCnt                index of the entry
@throws TikaException if the document could not be parsed
@throws IOException   if a UnsupportedZipFeatureException is met
@throws SAXException  if the SAX events could not be processed
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/PackageParser.java