本文整理了Java中org.openide.filesystems.FileUtil.setMIMEType()
方法的一些代码示例,展示了FileUtil.setMIMEType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.setMIMEType()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:setMIMEType
[英]Registers specified extension to be recognized as specified MIME type. If MIME type parameter is null, it cancels previous registration. Note that you may register a case-sensitive extension if that is relevant (for example .C for C++) but if you register a lowercase extension it will by default apply to uppercase extensions too on Windows.
[中]将指定的扩展注册为指定的MIME类型。如果MIME类型参数为null,则会取消以前的注册。请注意,如果大小写敏感扩展名是相关的(例如.C for C++),则可以注册该扩展名,但如果注册小写扩展名,则默认情况下它也将应用于Windows上的大写扩展名。
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
public void addExtension(String ext) {
if (!getValues().contains(ext)) {
exts.add(ext);
FileUtil.setMIMEType(ext, mimeType);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl
@SuppressWarnings("deprecation")
private static void setUp() {
// this is the only way to init extension-based recognizer
FileUtil.setMIMEType("cc", MIMENames.CPLUSPLUS_MIME_TYPE); // NOI18N
FileUtil.setMIMEType("h", MIMENames.HEADER_MIME_TYPE); // NOI18N
FileUtil.setMIMEType("c", MIMENames.C_MIME_TYPE); // NOI18N
JEditorPane.registerEditorKitForContentType(MIMENames.CPLUSPLUS_MIME_TYPE, "org.netbeans.modules.cnd.editor.cplusplus.CCKit"); // NOI18N
JEditorPane.registerEditorKitForContentType(MIMENames.HEADER_MIME_TYPE, "org.netbeans.modules.cnd.editor.cplusplus.HKit"); // NOI18N
JEditorPane.registerEditorKitForContentType(MIMENames.C_MIME_TYPE, "org.netbeans.modules.cnd.editor.cplusplus.CKit"); // NOI18N
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
FileUtil.setMIMEType(ext, null);
FileUtil.setMIMEType(ext, mimeType);
代码示例来源:origin: it.tidalwave.metadata/it-tidalwave-metadata-viewer
@Before
public void setupFixture()
throws IOException, NoSuchMetadataTypeException
{
panelProvider = new MetadataPanelProviderMock();
FileUtil.setMIMEType("test", "image/test");
final FileSystem fileSystem = FileUtil.createMemoryFileSystem();
final FileObject root = fileSystem.getRoot();
dataObjectWithNoMetadata = DataObject.find(root.createData("nometadata.test"));
assertTrue(dataObjectWithNoMetadata instanceof DataObjectMock);
assertNull(dataObjectWithNoMetadata.getLookup().lookup(Metadata.class));
dataObjectWithItem = DataObject.find(root.createData("item.test"));
assertTrue(dataObjectWithItem instanceof DataObjectMock);
Metadata metadata = dataObjectWithItem.getLookup().lookup(Metadata.class);
assertNotNull(metadata);
MetadataItemHolder<MetadataItemMock> holder = metadata.findOrCreateItem(MetadataItemMock.class, INTERNAL);
assertNotNull(holder);
assertTrue(holder.isAvailable());
dataObjectWithNoItem = DataObject.find(root.createData("noitem.test"));
assertTrue(dataObjectWithNoItem instanceof DataObjectMock);
metadata = dataObjectWithNoItem.getLookup().lookup(Metadata.class);
assertNotNull(metadata);
holder = metadata.findOrCreateItem(MetadataItemMock.class, INTERNAL);
assertNotNull(holder);
assertFalse(holder.isAvailable());
}
内容来源于网络,如有侵权,请联系作者删除!