【发布时间】:2016-04-27 14:18:05
【问题描述】:
我试图用 Apache Tika 解析 iWorksDoc。但是我没有得到解析的内容,而是从内容处理程序中获取一些其他输出。 我使用的代码 sn-p 和我得到的输出添加在下面。
private void parseFile(File file) {
try{
File file = new File("/home/user/tika/samples/budget.numbers");
FileInputStream inputStream = new FileInputStream(file);
ParseContext context = new ParseContext();
BodyContentHandler bodyHandler = new BodyContentHandler(-1);
Parser parser=new AutoDetectParser();
parser.parse(inputStream, bodyHandler, new Metadata(), context);
System.out.println("Contents of the file :"+bodyHandler.toString());
}
catch(IOException | SAXException | TikaException e){
e.printStackTrace();
}
}
输出:-
Contents of the file :
Index/Document.iwa
Index/ViewState.iwa
Index/CalculationEngine.iwa
Index/Tables/HeaderStorageBucket-2.iwa
Index/Tables/Tile.iwa
Index/Metadata.iwa
Metadata/Properties.plist
我能够正确使用 Detector api 检测文件类型。但是我没有从文档中获取有用的内容。请帮忙!
【问题讨论】:
标签: java lucene apache-tika text-extraction