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?