当前位置 : 首页 » 文章分类 :  开发  »  Apache-Tika

Apache-Tika

Apache Tika 文档解析


文档解析示例

@Test
@SneakyThrows
public void testParser() {
    AutoDetectParser parser = new AutoDetectParser();
    BodyContentHandler handler = new BodyContentHandler();
    Metadata metadata = new Metadata();
    String filePath = "/path-to-doc.docx";
    try (InputStream stream = new FileInputStream(filePath)) {
        parser.parse(stream, handler, metadata);
        log.info(handler.toString());
    } catch (Exception e) {
        log.error("解析失败", e);
    }
}

下一篇 MinIO

阅读
评论
70
阅读预计1分钟
创建日期 2024-06-11
修改日期 2024-06-11
类别
标签

页面信息

location:
protocol:
host:
hostname:
origin:
pathname:
href:
document:
referrer:
navigator:
platform:
userAgent:

评论