I\'ve created .csv
file using excel and I wrote following code using apache tika:
public static boolean checkThatMimeTypeIsCsv(InputStream input
Try this...
public static String checkThatMimeTypeIsCsv(String fileName ) throws Exception {
File sourceFile = new File(fileName );
DefaultDetector file_detector = new DefaultDetector();
TikaInputStream file_stream = TikaInputStream.get(sourceFile);
Metadata metadata = new Metadata();
metadata.set(Metadata.RESOURCE_NAME_KEY, sourceFile.getName());
MediaType mediaType = file_detector.detect(file_stream, metadata);
String file_type = mediaType.toString();
System.out.println(file_type);
return file_type;
}