Currently I'm using
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
String mimeType = mimeTypesMap.getContentType(logAttachmentFile.getFilePath());
This works fine with .jpg for example, however most other file types return as application/octet-stream
(.xls, .docx, .png) thus making it impossible for me to display the file. Is there a way to determine the proper file type without a third party library? If not, what is the best choice?