@Override
    public MediaType streamingDetectFinal(StreamingDetectContext detectContext) {
        OOXMLHintCounter cnt = detectContext.get(OOXMLHintCounter.class);
        if (cnt != null && cnt.getCount() > 2) {
            return TIKA_OOXML;
        }
        return null;
    }
Detects the type of an OfficeOpenXML (OOXML) file from
opened Package
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/detect/microsoft/ooxml/OPCPackageDetector.java