Netbeans API : get mime string from File object

Netbeans API : get mime string from File object

2017/09/20 Netbeans 0
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);