org.openide.filesystems.FileUtil.getMIMETypeOrDefault()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.openide.filesystems.FileUtil.getMIMETypeOrDefault()方法的一些代码示例,展示了FileUtil.getMIMETypeOrDefault()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.getMIMETypeOrDefault()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:getMIMETypeOrDefault

FileUtil.getMIMETypeOrDefault介绍

[英]Finds mime type by calling getMIMEType, but instead of returning null it fallbacks to default type either text/plain or content/unknown (even for folders)
[中]通过调用getMIMEType查找mime类型,但它不会返回null,而是返回默认类型text/plain或content/unknown(即使对于文件夹也是如此)

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Get the MIME type of this file.
* The MIME type identifies the type of the file's contents and should be used in the same way as in the <B>Java
* Activation Framework</B> or in the {@link java.awt.datatransfer} package.
* <P>
* The default implementation calls {@link FileUtil#getMIMEType}.
* (As a fallback return value, <code>content/unknown</code> is used.)
* @return the MIME type textual representation, e.g. <code>"text/plain"</code>; never <code>null</code>
*/
public String getMIMEType () {
  return FileUtil.getMIMETypeOrDefault (this);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Get the MIME type of this file.
* The MIME type identifies the type of the file's contents and should be used in the same way as in the <B>Java
* Activation Framework</B> or in the {@link java.awt.datatransfer} package.
* <P>
* The default implementation calls {@link FileUtil#getMIMEType}.
* (As a fallback return value, <code>content/unknown</code> is used.)
* @return the MIME type textual representation, e.g. <code>"text/plain"</code>; never <code>null</code>
*/
public String getMIMEType () {
  return FileUtil.getMIMETypeOrDefault (this);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public String getMIMEType () {
  String retVal = getAbstractFileSystem ().info.mimeType (getPath ());
  if (retVal == null) retVal = FileUtil.getMIMETypeOrDefault (this);        
  return retVal;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public String getMIMEType () {
  String retVal = getAbstractFileSystem ().info.mimeType (getPath ());
  if (retVal == null) retVal = FileUtil.getMIMETypeOrDefault (this);        
  return retVal;
}

相关文章

微信公众号

最新文章

更多