Java Example Program/ Sample Source Code
import javax.activation.MimetypesFileTypeMap;
import java.awt.datatransfer.MimeTypeParseException;
import java.io.File;
class MimeTypeParseExceptionExample {
public static void main(String args[]) throws MimeTypeParseException {
File f = new File("gumby.gif");
System.out.println("Mime Type of " + f.getName() + " is "
+ new MimetypesFileTypeMap().getContentType(f));
// expected output :
// "Mime Type of gumby.gif is image/gif"
}
} |
|
|