public class MimeHelper extends Object
Contains an internal table of the most common file extensions along with their mime type.
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_PDF
Mime type of PDF files
|
static String |
APPLICATION_X_SHOCKWAVE_FLASH
Mime type of flash (swf) files.
|
static String |
APPLICATION_ZIP
Mime type of zip files
|
static String |
AUDIO_MPEG
Mime type of mpeg sound files (MP3)
|
static String |
IMAGE_JPEG
Mime type of JPEG images
|
static String |
IMAGE_PNG
Mime type of PNG images
|
static String |
IMAGE_SVG
Mime type of SVG images
|
static String |
TEXT_CSS
Mime type of CSS files
|
static String |
TEXT_CSV
Mime type of csv files
|
static String |
TEXT_HTML
Mime type of HTML files
|
static String |
TEXT_JAVASCRIPT
Mime type of javascript (JS) files
|
static String |
TEXT_PLAIN
Mime type of plain text files
|
static String |
TEXT_XML
Mime type of XML files
|
static String |
VIDEO_MP2T
Mime type of Blu-ray Disc Audio-Video (BDAV) MPEG-2 Transport Stream (M2TS)
|
static String |
VIDEO_MP4
Mime type of mpeg 4 video files
|
static String |
VIDEO_MPEG
Mime type of mpeg video files
|
static String |
VIDEO_OGG
Mime type of ogg vorbis video files
|
static String |
VIDEO_QUICKTIME
Mime type of quicktime videos
|
Modifier and Type | Method and Description |
---|---|
static String |
guessMimeType(String name)
Tries to guess the mime type for the given file, path or url based on its file ending.
|
static boolean |
isCompressable(String contentType)
Determines if it is recommended to compress data of the given mime type.
|
public static final String APPLICATION_X_SHOCKWAVE_FLASH
public static final String IMAGE_PNG
public static final String IMAGE_JPEG
public static final String IMAGE_SVG
public static final String APPLICATION_PDF
public static final String TEXT_PLAIN
public static final String TEXT_CSS
public static final String TEXT_HTML
public static final String TEXT_XML
public static final String TEXT_CSV
public static final String TEXT_JAVASCRIPT
public static final String AUDIO_MPEG
public static final String VIDEO_MPEG
public static final String VIDEO_OGG
public static final String VIDEO_MP4
public static final String VIDEO_MP2T
public static final String APPLICATION_ZIP
public static final String VIDEO_QUICKTIME
public static String guessMimeType(String name)
name
- the filename, path or URL to use to detect the mime typepublic static boolean isCompressable(@Nullable String contentType)
It isn't very useful to compress JPEG or PNG files, as they are already compressed. This method is very pessimistic: Only a set of known content types is accepted as compressable.
contentType
- the mime type to checkCopyright © 2018. All rights reserved.