Say the mine type of the commonly used files:
MIME Type |
File Extensions |
Application/msword |
Doc |
Application/pdf |
Pdf |
Application/rtf |
Rtf |
Application/vnd.ms-excel |
Xls |
Application/vnd.ms-powerpoint |
Ppt |
Application/x-rar-compressed |
rar |
Application/x-shockwave-flash |
Swf |
Application/zip |
Zip |
Audio/midi |
Mid midi Kar |
Audio/mpeg |
mp3 |
Audio/ogg |
Ogg |
audio/x-m4a |
m4a |
Audio/x-realaudio |
Ra |
Image/gif |
Gif |
Image/jpeg |
JPEG jpg |
Image/png |
Png |
Image/tiff |
TIF TIFF |
Image/vnd.wap.wbmp |
Wbmp |
Image/x-icon |
Ico |
Image/x-jng |
Jng |
Image/x-ms-bmp |
Bmp |
Image/svg+xml |
SVG svgz |
Image/webp |
Webp |
Text/css |
Css |
Text/html |
HTML htm shtml |
Text/plain |
Txt |
Text/xml |
Xml |
Video/3gpp |
3GPP 3gp |
Video/mp4 |
mp4 |
Video/mpeg |
MPEG mpg |
Video/quicktime |
mov |
Video/webm |
WebM |
video/x-flv |
flv |
video/x-m4v |
m4v |
Video/x-ms-wmv |
Wmv |
Video/x-msvideo |
Avi |
Java programmatic way to get:
Environment, dependent jars:
<dependency>
<groupId>eu.medsea.mimeutil</groupId>
<artifactid>mime-util</ artifactid>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactid>slf4j-api</artifactid >
<version>1.7.13</version>
</dependency>
Test:
Import Java.io.File;
Import java.util.Collection;
Import Eu.medsea.mimeutil.MimeUtil;
public class Minetypetest {public
static void Main (string[] args) {
mimeutil.registermimedetector (" Eu.medsea.mimeutil.detector.MagicMimeMimeDetector ");
File F = new file ("e:/chatdemo-ui.apk");
File F = new file ("E:/111.jpg");
collection<?> mimetypes = Mimeutil.getmimetypes (f);
System.out.println (mimetypes);
}