List of utility methods to do Mime Type Get
String | getMimeType(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"; ... |
boolean | isRotationSupported(String mimeType) is Rotation Supported if (mimeType == null) return false; mimeType = mimeType.toLowerCase(); return mimeType.equals("image/jpeg"); |
boolean | isSupportedByRegionDecoder(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")); |
String | getMimeType(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; |
String | getMIMEType(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 == "") ... |
String | guessMime(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)) ... |