This method should be check if a file is MIME type. To achieve this goal I am using method probeContentType().
However maybe is another way to decide same question. Which are the other alternatives (if there are any)?
Code:
class ProbeContentTypeCheker implements Checker {
@Override
public boolean check(File fileCheck) {
try {
Path filePath = FileSystems.getDefault().getPath(
fileCheck.getAbsolutePath());
if ((Files.probeContentType(filePath) != null)) {
return true;
}
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}
Question:
- Are there other alternatives to check MIME type in files?