如何从Mbox文件获取Apache Tika的附件?

时间:2019-04-09 09:13:12

标签: java apache-tika mbox

我有一个mbox文件https://pastebin.com/mGq0gB8S,带有base64编码的附件。我想使用Apache Tika Mbox parser获得附件。我的代码在这里:

TypeDetector typeDetector = new TypeDetector();
Parser autoDetectParser = new AutoDetectParser(typeDetector);
ParseContext recursingContext = new ParseContext();
recursingContext.set(Parser.class, autoDetectParser);
mboxParser = new MboxParser();
mboxParser.setTracking(true);

ContentHandler handler = new BodyContentHandler(); // do I need another handler? but which? or what?
Metadata metadata = new Metadata();

InputStream stream = getISByPath(path);
mboxParser.parse(stream, handler, metadata, recursingContext);

System.out.println(handler.toString()); // here I want to see a base64 code of an encoded image

如何从mbox主体获取base64编码的图像?

0 个答案:

没有答案