Identity MIME type of a file
This code will help to find the mime type of a file : download the complete code mimetype.java
a code snippet from mimetype.java :
public String getMimeType(String fileName) throws Exception { header = readHeader(this.fileName); String mime = new String("unknown"); if(!(mime=isDocument(header) ).equals("unknown") ) { return mime; } else if(!(mime=isText(header)) .equals("unknown") ) { return mime; } else if (!(mime = isHtml (header)).equals ("unknown")) { return mime; } else if (!(mime = isVideo (header)).equals ("unknown")) { return mime; } else if(!(mime=isImage( header)) .equals("unknown") ) { return mime; } return mime; }
About this entry
You’re currently reading “Identity MIME type of a file,” an entry on Quality Obsessed
- Published:
- 03.08.08 / 9am
- Rate article:
Printer Friendly

No comments
Jump to comment form | comments rss [?] | trackback uri [?]