Java documentation forandroid.webkit.MimeTypeMap.getMimeTypeFromExtension(java.lang.String). Portions of this page are modifications based on work created and shared by theAndroid Open Source Projectand used according to terms described in theCreative Commons 2.5 Attribution License. ...
String type ="*/*";finalString extension = getExtension(file.getName());if(extension !=null&& !extension.isEmpty()) {finalString extensionLowerCase = extension.toLowerCase(Locale .getDefault());finalMimeTypeMap mime = MimeTypeMap.getSingleton(); type = mime.getMimeTypeFromExtension(extension...
方法名:getMimeTypeFromExtension MimeTypeMap.getMimeTypeFromExtension介绍 暂无 代码示例 代码示例来源:origin: stackoverflow.com MimeTypeMap myMime = MimeTypeMap.getSingleton(); Intent newIntent = new Intent(Intent.ACTION_VIEW); String mimeType = myMime.getMimeTypeFromExtension(fileExt(getFile())....
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(suffix); if (type != null || !type.isEmpty()) { return type; } return "file/*"; } 方法2: public static String getMimeType(String filePath) { MediaMetadataRetriever mmr = new MediaMetadataRetriever(); String mime = "te...
fileName.substring(index+1).toLowerCase(Locale.US);}else{returnnull;}}publicstaticStringgetMimeType(Filefile){Stringsuffix=getSuffix(file);if(suffix==null){return"file/*";}Stringtype=MimeTypeMap.getSingleton().getMimeTypeFromExtension(suffix);if(type!=null||!type.isEmpty()){returntype;}...
getContentResolver().getType(contentUri); if (type == null) { String ext = MimeTypeMap.getFileExtensionFromUrl(contentUri.getPath()); if (ext != null) { type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext); } } if (type == null) { type = ""; } return type; } ...
在下文中一共展示了IOHelper::getMimeTypeByExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。 示例1: renderTemplate ▲点赞 7▼ /** * Renders a template, and either outputs or returns it. ...
filename (file.txt) or extension (.txt or txt) /// <returns>A valid Mime Type (es. text/plain)</returns> public static string GetMimeTypeByWindowsRegistry(string fileNameOrExtension) { string mimeType = "application/unknown"; string ext = (fileNameOrExtension.Contains(".")) ? System....
get-mime-type Get a mime-type from a filename or extension with no fuzz. npm install get-mime-type API mime = getMimeType(name, charset = true) Get a mime / content type for a name or extension. If charset is true (default) it adds the charset for known extensions...
If the input string is not a valid MIME type, theextension()method returnsfalse: mime.extension('node/basic')// falsemime.extension('image/jpg')// false If you already know the filename, you could use the built-inpathmodule toget file extension: ...