本文整理了Java中org.apache.tika.Tika.getParser()
方法的一些代码示例,展示了Tika.getParser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tika.getParser()
方法的具体详情如下:
包路径:org.apache.tika.Tika
类名称:Tika
方法名:getParser
[英]Returns the parser instance used by this facade.
[中]返回此外观使用的解析器实例。
代码示例来源:origin: apache/tika
public boolean findInFile(String query, Path path) {
InterruptingContentHandler handler = new InterruptingContentHandler(query);
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
context.set(Parser.class, tika.getParser());
try (InputStream is = new BufferedInputStream(Files.newInputStream(path))) {
tika.getParser().parse(is, handler, metadata, context);
} catch (QueryMatchedException e) {
return true;
} catch (SAXException | TikaException | IOException e) {
// something went wrong with parsing...
e.printStackTrace();
}
return false;
}
代码示例来源:origin: stackoverflow.com
InterruptingContentHandler handler = new InterruptingContentHandler(query);
ParseContext context = new ParseContext();
context.set(Parser.class, tika.getParser());
tika.getParser().parse(is, handler, metadata, context);
} catch (QueryMatchedException e) {
return true;
代码示例来源:origin: ukwa/webarchive-discovery
ParseRunner runner = new ParseRunner( source, tika.getParser(), tikainput, this.getHandler( content ), metadata, context );
try {
TimeLimiter.run(runner, parseTimeout, true);
代码示例来源:origin: uk.bl.wa.discovery/warc-indexer
ParseRunner runner = new ParseRunner( source, tika.getParser(), tikainput, this.getHandler( content ), metadata, context );
try {
TimeLimiter.run(runner, parseTimeout, true);
代码示例来源:origin: DigitalPebble/storm-crawler
parseContext.set(Parser.class, tika.getParser());
tika.getParser().parse(bais, teeHandler, md, parseContext);
text = textHandler.toString();
} catch (Throwable e) {
内容来源于网络,如有侵权,请联系作者删除!