|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Content types represent and provide information on file types, such as associated file names/extensions, default charset, etc.
This interface is not intended to be implemented by clients.
Field Summary | |
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 pre-defined 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. |
Method Summary | |
void |
addFileSpec(String fileSpec,
int type)
Adds a user-defined file specification to this content type. |
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 |
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. |
boolean |
isAssociatedWith(String fileName)
Returns whether this content type is associated with the given file name. |
boolean |
isKindOf(IContentType another)
Returns whether this content type is a kind of the given content type. |
void |
removeFileSpec(String fileSpec,
int type)
Removes a user-defined file specification from this content type. |
void |
setDefaultCharset(String userCharset)
Sets the default charset for this content type. |
Field Detail |
public static final int IGNORE_PRE_DEFINED
public static final int IGNORE_USER_DEFINED
public static final int FILE_NAME_SPEC
public static final int FILE_EXTENSION_SPEC
Method Detail |
public void addFileSpec(String fileSpec, int type) throws CoreException
fileSpec
- the file specificationtype
- the type of the file specification. One of
FILE_NAME_SPEC
,
FILE_EXTENSION_SPEC
.
IllegalArgumentException
- if the type bit mask is
incorrect
CoreException
- if this method fails. Reasons include:
FILE_NAME_SPEC
,
FILE_EXTENSION_SPEC
public void removeFileSpec(String fileSpec, int type) throws CoreException
fileSpec
- the file specificationtype
- the type of the file specification. One of
FILE_NAME_SPEC
,
FILE_EXTENSION_SPEC
.
IllegalArgumentException
- if the type bit mask is
incorrect
CoreException
- if this method fails. Reasons include:
FILE_NAME_SPEC
,
FILE_EXTENSION_SPEC
public IContentType getBaseType()
null
.
null
public 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 described
null
IOException
- if an error occurs while reading the contentsIContentDescription
public 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 described
null
UnsupportedOperationException
- if this content type
has a describer that does not implement
ITextContentDescriber
IOException
- if an error occurs while reading the contentsIContentDescription
public String getDefaultCharset()
null
otherwise.
null
public String[] getFileSpecs(int type)
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
public String getId()
public String getName()
public boolean isAssociatedWith(String fileName)
fileName
- the file name
true
if this content type is associated with
the given file name, false
otherwisepublic boolean isKindOf(IContentType another)
another
- a content type
true
if this content type is a kind of the
given content type, false
otherwisepublic void setDefaultCharset(String userCharset) throws CoreException
null
is provided, restores the pre-defined default charset.
userCharset
- the new charset for this content type, or
null
CoreException
- if this method fails. Reasons include:
|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.