Java ProbeContentType
java
Solution
According to oracle,
"The implementation of this method is highly platform specific and is not infallible. The content type is determind by the platform's default file type detector. For example, if the detector determines a file's content type to be application/x-java based on the .class extension, it might be fooled."
http://docs.oracle.com/javase/tutorial/essential/io/misc.html
You can also write your own FileTypeDetector. If you don't, the default FileTypeDetector will be used. i.e. in Linux they use sun.nio.fs.GnomeFileTypeDetector
Problem
How does Probe Content Type in java work? Some resources highlight that it is based on file extension and other resources such as this one indicate that a bug exists. I've created a excel file and using save as I've saved it as myexcelfile.txt and ProbeContentType reported it as application/zip hence proving that it is not based on extension, now this has created further confusion as the link I've provided is from Oracle and states both extension wise and byte wise verification. What is the fact? How does ProbeContentType actually work?