Netbeans API : get mime string from File object
File targetFile=...
FileObject fileObject = FileUtil.toFileObject(targetFile);
ModuleLib.log("fileObject=" + fileObject + ", " + targetFile.getAbsolutePath());
DataObject dataObject3 = DataObject.find(fileObject);
EditorCookie ecA = dataObject3.getLookup().lookup(EditorCookie.class);
Document doc2A = ecA.getDocument();
String mime = (String) doc2A.getProperty("mimeType");
System.out.println(mime);