How to write a probeContentType() and Usage?
Files.probeContentType() is an instance of FileTypeDetector class's abstract method String FileTypeDetector.probeContentType(), it's an extension based detector. So extend it in a new class or even anonyinter class (cannot do that because FileTypeDetector is an abstract class) might work.
1 public class MyDetector extends java.nio.file.spi.FileTypeDetector{ 2 public String probeContentType(Path path) throws IOException{ 3 return SOMESTRING; 4 } 5 }
1 //Call the detector 2 String type = MyDetector.probeContentType(path);
Anyone is permitted to copy/use the contents and codes from this blog.
Sansna is not going to guarantee anything, Sansna will not take any responsibility of any results after using these codes/contents.