public abstract class MIMEResolver extends Object
FileUtil.getMIMEType(org.openide.filesystems.FileObject, java.lang.String[])
to invoke the mime resolving infrastructure.
All registered mime resolvers are looked up and asked one by one
to resolve MIME type
of passed in FileObject
. Resolving is finished right after
a resolver is able to resolve the FileObject or if all registered
resolvers returned null
(not recognized).
Use MIMEResolver.ExtensionRegistration
,
MIMEResolver.NamespaceRegistration
or MIMEResolver.Registration
to register declarative resolvers.
In the rarely case, when declarative resolvers are not sufficient, you can
register subclass of MIMEResolver
directly by using ServiceProvider
annotation.
Modifier and Type | Class and Description |
---|---|
static interface |
MIMEResolver.ExtensionRegistration
Often a mime type can be deduced just by looking at a file extension.
|
static interface |
MIMEResolver.NamespaceRegistration
Recognize mime type by looking into header of XML files.
|
static interface |
MIMEResolver.Registration
Registration that allows effective, declarative registration of
complex
mime resolvers . |
class |
MIMEResolver.UIHelpers
Internal support for implementors of MIME resolver UIs.
|
Constructor and Description |
---|
MIMEResolver()
Deprecated.
Use
MIMEResolver.MIMEResolver(String...) instead. Declaring MIME
types which can only be resolved by this resolver helps to speed up IDE. |
MIMEResolver(String... mimeTypes)
Creates a new MIMEResolver.
|
Modifier and Type | Method and Description |
---|---|
abstract String |
findMIMEType(FileObject fo)
Resolves FileObject and returns recognized MIME type
|
public MIMEResolver(String... mimeTypes)
mimeTypes
- an array of MIME types which can be resolved by this resolver.
It should contain all MIME types which MIMEResolver.findMIMEType(org.openide.filesystems.FileObject)
can return.
If something is missing, this resolver can be ignored, when searching for that
missing MIME type (see FileUtil.getMIMEType(FileObject, String...)
).@Deprecated public MIMEResolver()
MIMEResolver.MIMEResolver(String...)
instead. Declaring MIME
types which can only be resolved by this resolver helps to speed up IDE.public abstract String findMIMEType(FileObject fo)
fo
- is FileObject which should be resolved (This FileObject is not
thread safe. Also this FileObject should not be cached for later use)