public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {

        // We work by recursing, so get the appropriate bits
        EmbeddedDocumentExtractor embeddedExtractor =
                EmbeddedDocumentUtil.getEmbeddedDocumentExtractor(context);

        // Ask POI to process the file for us
        HMEFMessage msg = new HMEFMessage(stream);

        // Set the message subject if known
        String subject = msg.getSubject();
        if (subject != null && subject.length() > 0) {
            metadata.set(TikaCoreProperties.TITLE, subject);
            metadata.set(TikaCoreProperties.SUBJECT, subject);
        }
        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();
        // Recurse into the message body RTF
        MAPIAttribute attr = msg.getMessageMAPIAttribute(MAPIProperty.RTF_COMPRESSED);
        if (attr != null && attr instanceof MAPIRtfAttribute) {
            MAPIRtfAttribute rtf = (MAPIRtfAttribute) attr;
            handleEmbedded("message.rtf", "application/rtf", rtf.getData(), embeddedExtractor,
                    xhtml);
        }

        // Recurse into each attachment in turn
        for (Attachment attachment : msg.getAttachments()) {
            String name = attachment.getLongFilename();
            if (name == null || name.isEmpty()) {
                name = attachment.getFilename();
            }
            if (name == null || name.isEmpty()) {
                String ext = attachment.getExtension();
                if (ext != null) {
                    name = "unknown" + ext;
                }
            }
            handleEmbedded(name, null, attachment.getContents(), embeddedExtractor, xhtml);
        }
        xhtml.endDocument();
    }
Extracts properties and text from an MS Document input stream
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/TNEFParser.java