public interface IContentType extends IContentTypeSettings
This interface is not intended to be implemented by clients.
Modifier and Type | Field and Description |
---|---|
static int |
FILE_EXTENSION_SPEC
File spec type constant, indicating a file extension specification.
|
static int |
FILE_NAME_SPEC
File spec type constant, indicating a file name specification.
|
static int |
IGNORE_PRE_DEFINED
File spec type flag constant, indicating that predefined file
specifications should not be taken into account.
|
static int |
IGNORE_USER_DEFINED
File spec type flag constant, indicating that user-defined file
specifications should not be taken into account.
|
Modifier and Type | Method and Description |
---|---|
IContentType |
getBaseType()
Returns a reference to this content type's base type.
|
String |
getDefaultCharset()
Returns the default charset for this content type if one has been defined,
null otherwise. |
IContentDescription |
getDefaultDescription()
Returns the default content description for this content type.
|
IContentDescription |
getDescriptionFor(InputStream contents,
QualifiedName[] options)
Tries to obtain a description for the given contents.
|
IContentDescription |
getDescriptionFor(Reader contents,
QualifiedName[] options)
Tries to obtain a description for the given contents.
|
String[] |
getFileSpecs(int type)
Returns file specifications from this content type.
|
String |
getId()
Returns this content type's unique identifier.
|
String |
getName()
Returns a user-friendly name for this content type.
|
IContentTypeSettings |
getSettings(IScopeContext context)
Returns the settings for this content type in the given
preference context.
|
boolean |
isAssociatedWith(String fileName)
Returns whether this content type is associated with the
given file name.
|
boolean |
isAssociatedWith(String fileName,
IScopeContext context)
Returns whether this content type is associated with the
given file name in the given preference scope.
|
boolean |
isKindOf(IContentType another)
Returns whether this content type is a kind of the given content
type.
|
addFileSpec, removeFileSpec, setDefaultCharset
static final int IGNORE_PRE_DEFINED
static final int IGNORE_USER_DEFINED
static final int FILE_NAME_SPEC
static final int FILE_EXTENSION_SPEC
IContentType getBaseType()
null
.null
IContentDescription getDefaultDescription()
Clients doing caching of content descriptions may choose to treat default descriptions in a special manner, since they are easily recoverable through this API.
IContentDescription getDescriptionFor(InputStream contents, QualifiedName[] options) throws IOException
Any IOExceptions that may occur while reading the given input stream will flow to the caller. The input stream will not be closed by this operation.
contents
- the contents to be interpretedoptions
- an array of keys for all properties that should be describednull
IOException
- if an error occurs while reading the contentsIContentDescription
IContentDescription getDescriptionFor(Reader contents, QualifiedName[] options) throws IOException
Any IOExceptions that may occur while reading the given reader will flow to the caller. The reader will not be closed by this operation.
contents
- the contents to be interpretedoptions
- an array of keys for all properties that should be describednull
UnsupportedOperationException
- if this content type
has a describer that does not implement
ITextContentDescriber
IOException
- if an error occurs while reading the contentsIContentDescription
String getDefaultCharset()
null
otherwise.
This refinement of the corresponding IContentTypeSettings
method also takes into account the charset defined by the content type
provider (or its base content type).getDefaultCharset
in interface IContentTypeSettings
null
String[] getFileSpecs(int type)
IContentTypeSettings
method supports additional flags because it also takes into account the
file specifications defined by the content type provider (or its base
content type).getFileSpecs
in interface IContentTypeSettings
type
- a bit-wise or of file specification type constants. Valid
flags are:
FILE_EXTENSION_SPEC
or
FILE_NAME_SPEC
IGNORE_PRE_DEFINED
or IGNORE_USER_DEFINED
FILE_NAME_SPEC
,
FILE_EXTENSION_SPEC
,
IGNORE_PRE_DEFINED
,
IGNORE_USER_DEFINED
String getId()
getId
in interface IContentTypeSettings
String getName()
boolean isAssociatedWith(String fileName)
fileName
- the file nametrue
if this content type is associated with
the given file name, false
otherwiseisAssociatedWith(String, IScopeContext)
boolean isAssociatedWith(String fileName, IScopeContext context)
fileName
- the file namecontext
- a preference scope contexttrue
if this content type is associated with
the given file name, false
otherwiseboolean isKindOf(IContentType another)
another
- a content typetrue
if this content type is a kind of the
given content type, false
otherwiseIContentTypeSettings getSettings(IScopeContext context) throws CoreException
context
- a preference scope contextCoreException
- if this method fails. Reasons include:
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.