Android Utililty Methods Mime Type Get

List of utility methods to do Mime Type Get

Description

The list of methods to do Mime Type Get are organized into topic(s).

Method

StringgetMimeType(byte[] bytes)
get Mime Type
String suffix = getFileSuffix(bytes);
String mimeType;
if ("JPG".equals(suffix)) {
    mimeType = "image/jpeg";
} else if ("GIF".equals(suffix)) {
    mimeType = "image/gif";
} else if ("PNG".equals(suffix)) {
    mimeType = "image/png";
...
booleanisRotationSupported(String mimeType)
is Rotation Supported
if (mimeType == null)
    return false;
mimeType = mimeType.toLowerCase();
return mimeType.equals("image/jpeg");
booleanisSupportedByRegionDecoder(String mimeType)
is Supported By Region Decoder
if (mimeType == null)
    return false;
mimeType = mimeType.toLowerCase();
return mimeType.startsWith("image/")
        && (!mimeType.equals("image/gif") && !mimeType
                .endsWith("bmp"));
StringgetMimeType(String url)
get Mime Type
String type = null;
String extension = MimeTypeMap.getFileExtensionFromUrl(url);
if (extension != null) {
    MimeTypeMap mime = MimeTypeMap.getSingleton();
    type = mime.getMimeTypeFromExtension(extension);
return type;
StringgetMIMEType(String fName)
get MIME Type
String type = "*/*";
int dotIndex = fName.lastIndexOf(".");
if (dotIndex < 0) {
    return type;
String end = fName.substring(dotIndex, fName.length())
        .toLowerCase();
if (end == "")
...
StringguessMime(String path)
TODO: use something more official, e.g.
String ext = getExtension(path);
if (".aac".equals(ext))
    return "audio/aac";
if (".flac".equals(ext))
    return "audio/flac";
if (".aiff".equals(ext))
    return "audio/aiff";
if (".aif".equals(ext))
...