简体   繁体   English

Java的Mime类型检测库

[英]Mime type detection library for Java

First, I saw this question ( Getting A File's Mime Type In Java ), but the selected answer is only a link. 首先,我看到了这个问题( 在Java中获取文件的Mime类型 ),但是所选答案只是一个链接。

I'm looking for a way to determine the MIME type of a file in Java, and I need a tool that can discover a lot of different types because I'm doing an webcrawler and it handle a lot of different MIMEs. 我正在寻找一种确定Java中文件的MIME类型的方法,并且我需要一个可以发现很多不同类型的工具,因为我正在做一个网络爬虫并且它可以处理很多不同的MIME。

I used JMimeMagic and appears simple and good, but is beta and there are some crashes. 我使用了JMimeMagic,看起来简单又不错,但是是beta版,并且发生了一些崩溃。 Apache Tika does a lot of things, including MIME detection, but is big. Apache Tika做很多事情,包括MIME检测,但功能强大。 The same occurs for some others libraries. 其他一些库也是如此。

I want to know if there is some MIME detection specific library (like JMimeMagic, but working) and that can recognizes a lot of MIME types, and not using only file extension. 我想知道是否有一些特定于MIME检测的库(例如JMimeMagic,但是可以工作),并且可以识别很多MIME类型,而不是仅使用文件扩展名。 If not, the bigger libraries like Apache Tika are the right choice? 如果不是,那么像Apache Tika这样的大型库是正确的选择吗?

Apache Tika is the most comprehensive choice so far. 到目前为止,Apache Tika是最全面的选择。 I would suggest to go with it. 我建议随它去。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM