public void parse(InputStream stream, ContentHandler handler,
Metadata metadata, ParseContext context) throws IOException,
SAXException, TikaException {
// Get the mime4j configuration, or use a default one
MimeConfig config = new MimeConfig();
config.setMaxLineLen(10000); // max length of any individual header
config = context.get(MimeConfig.class, config);
MimeStreamParser parser = new MimeStreamParser(config);
XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
MailContentHandler mch = new MailContentHandler(
xhtml, metadata, config.isStrictParsing());
parser.setContentHandler(mch);
parser.setContentDecoding(true);
TaggedInputStream tagged = TaggedInputStream.get(stream);
try {
parser.parse(tagged);