private void handleCompObj(DirectoryEntry dir, POIFSDocumentType type, String rName,
                               Metadata metadata, XHTMLContentHandler xhtml, boolean outputHtml)
            throws IOException, SAXException {
        //TODO: figure out if the equivalent of OLE 1.0's
        //getCommand() and getFileName() exist for OLE 2.0 to populate
        //TikaCoreProperties.ORIGINAL_RESOURCE_NAME

        String contentsEntryName = getContentsEntryName(dir);
        if (contentsEntryName == null) {
            //log or record exception?
            return;
        }
        // Grab the contents and process
        DocumentEntry contentsEntry;

        try {
            contentsEntry = (DocumentEntry) dir.getEntry(contentsEntryName);
        } catch (FileNotFoundException fnfe) {
            EmbeddedDocumentUtil.recordEmbeddedStreamException(fnfe, parentMetadata);
            return;
        }

        int length = contentsEntry.getSize();
        DocumentInputStream inp = null;
        try {
            inp = new DocumentInputStream(contentsEntry);
        } catch (SecurityException e) {
            throw e;
        } catch (Exception e) {
            EmbeddedDocumentUtil.recordEmbeddedStreamException(e, parentMetadata);
            return;
        }
        try (TikaInputStream tis = TikaInputStream.get(inp)) {
            // Try to work out what it is
            MediaType mediaType = getDetector().detect(tis, metadata);
            String extension = type.getExtension();
            try {
                MimeType mimeType =
                        embeddedDocumentUtil.getMimeTypes().forName(mediaType.toString());
                extension = mimeType.getExtension();
            } catch (MimeTypeException mte) {
                // No details on this type are known
            }

            // Record what we can do about it
            metadata.set(Metadata.CONTENT_TYPE, mediaType.getType());
            metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, rName + extension);
            metadata.set(Metadata.CONTENT_LENGTH, Integer.toString(length));
            parseEmbedded(dir, tis, xhtml, metadata, outputHtml);
        } finally {
            inp.close();
        }
    }
Handle an office document that's embedded at the POIFS level
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/AbstractPOIFSExtractor.java