private MediaType detectZipFormatOnFile(TikaInputStream tis, Metadata metadata) {
        ZipFile zip = null;
        try {
            zip = ZipFile.builder().setFile(tis.getFile()).get();

            for (ZipContainerDetector zipDetector : getDetectors()) {
                MediaType type = zipDetector.detect(zip, tis);
                if (type != null) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("{} detected {}", zipDetector.getClass(),
                                type.toString());
                    }
                    //e.g. if OPCPackage has already been set
                    //don't overwrite it with the zip
                    if (tis.getOpenContainer() == null) {
                        tis.setOpenContainer(zip);
                    } else {
                        tis.addCloseableResource(zip);
                    }
                    return type;
                } else {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("{} detected null", zipDetector.getClass());
                    }
                }
            }
        } catch (IOException e) {
            //do nothing
        }
        // Fallback: it's still a zip file, we just don't know what kind of one
        if (zip != null) {
            IOUtils.closeQuietly(zip);
            return MediaType.APPLICATION_ZIP;
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("zip file failed to open; attempting streaming detect. Results may be imprecise");
        }
        //problem opening zip file (truncated?)
        try {
            return detectStreamingFromPath(tis.getPath(), metadata, false);
        } catch (IOException e) {
            //swallow
        }
        return MediaType.APPLICATION_ZIP;

    }
This will call TikaInputStream's getFile(). If there are no exceptions,
it will place the ZipFile in TikaInputStream's openContainer and leave it
open.

@param tis
@return
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-zip-commons/src/main/java/org/apache/tika/detect/zip/DefaultZipContainerDetector.java