type incorrectly for csv

I've created .csv file using excel and I wrote following code using 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")));
}

But it returns false '.

Does Tika so bad or I missed something?

链接地址: http://www.djcxy.com/p/47000.html

上一篇: iPhone SDK 3.2和UIAppFonts

下一篇: 为csv键入错误