为csv键入错误
我使用excel创建了.csv
文件,我使用apache tika编写了以下代码:
public static boolean checkThatMimeTypeIsCsv(InputStream inputStream) throws IOException {
BufferedInputStream bis = new BufferedInputStream(inputStream);
AutoDetectParser parser = new AutoDetectParser();
Detector detector = parser.getDetector();
Metadata md = new Metadata();
MediaType mediaType = detector.detect(bis, md);
return "text/csv".equals(mediaType.toString());
}
public static void main(String[] args) throws IOException {
System.out.println(checkThatMimeTypeIsCsv(new FileInputStream("Data.csv")));
}
但它返回false
“。
Tika如此糟糕还是我遗漏了一些东西?
链接地址: http://www.djcxy.com/p/46999.html