Package org.eclipse.core.runtime.content
Class XMLContentDescriber
- java.lang.Object
-
- org.eclipse.core.internal.content.TextContentDescriber
-
- org.eclipse.core.runtime.content.XMLContentDescriber
-
- All Implemented Interfaces:
IContentDescriber,ITextContentDescriber
- Direct Known Subclasses:
XMLRootElementContentDescriber,XMLRootElementContentDescriber2
public class XMLContentDescriber extends org.eclipse.core.internal.content.TextContentDescriberA content describer for XML files. This class provides basis for XML-based content describers.The document is detected by the describer as
Below are sample declarations recognized by the describer asVALID, if it contains an xml declaration with<?xmlprefix and the encoding in the declaration is correct.VALID- <?xml version="1.0"?>
- <?xml version="1.0"
- <?xml version="1.0" encoding="utf-16"?>
- <?xml version="1.0" encoding="utf-16?>
- Since:
- org.eclipse.core.contenttype 3.4
- See Also:
IContentDescriber,XMLRootElementContentDescriber2, "http://www.w3.org/TR/REC-xml *"- Restriction:
- This class is not intended to be instantiated by clients.
Clients should use it to provide their own XML-based
describers that can be referenced by the "describer"
configuration element in extensions to the
org.eclipse.core.runtime.contentTypesextension point.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.core.runtime.content.IContentDescriber
INDETERMINATE, INVALID, VALID
-
-
Constructor Summary
Constructors Constructor Description XMLContentDescriber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdescribe(InputStream input, IContentDescription description)Tries to fill a description for the given contents.intdescribe(Reader input, IContentDescription description)Tries to fill a description for the given contents.QualifiedName[]getSupportedOptions()Returns the properties supported by this describer.
-
-
-
Method Detail
-
describe
public int describe(InputStream input, IContentDescription description) throws IOException
Description copied from interface:IContentDescriberTries to fill a description for the given contents. Returns anintindicating whether the given stream of bytes represents a valid sample for its corresponding content type. If no content description is provided, this method should perform content type validation.The input stream must be kept open, and any IOExceptions while reading the stream should flow to the caller.
- Specified by:
describein interfaceIContentDescriber- Overrides:
describein classorg.eclipse.core.internal.content.TextContentDescriber- Parameters:
input- the contents to be examineddescription- a description to be filled in, ornullif only content type validation is to be performed- Returns:
- one of the following:
VALIDINVALIDINDETERMINATE
- Throws:
IOException- if an I/O error occurs- See Also:
IContentDescription,IContentDescriber.VALID,IContentDescriber.INVALID,IContentDescriber.INDETERMINATE
-
describe
public int describe(Reader input, IContentDescription description) throws IOException
Description copied from interface:ITextContentDescriberTries to fill a description for the given contents. Returns anintindicating whether the given stream of characters represents a valid sample for this describer's corresponding content type. If no content description is provided, this method should only perform content type validation.The stream provided must be kept open, and any IOExceptions while reading it should flow to the caller.
- Specified by:
describein interfaceITextContentDescriber- Overrides:
describein classorg.eclipse.core.internal.content.TextContentDescriber- Parameters:
input- the contents to be examineddescription- a description to be filled in, ornullif only content type validation is to be performed- Returns:
- one of the following:
VALIDINVALIDINDETERMINATE
- Throws:
IOException- if an I/O error occurs- See Also:
IContentDescription,IContentDescriber.VALID,IContentDescriber.INVALID,IContentDescriber.INDETERMINATE
-
getSupportedOptions
public QualifiedName[] getSupportedOptions()
Description copied from interface:IContentDescriberReturns the properties supported by this describer.- Specified by:
getSupportedOptionsin interfaceIContentDescriber- Overrides:
getSupportedOptionsin classorg.eclipse.core.internal.content.TextContentDescriber- Returns:
- the supported properties
- See Also:
IContentDescriber.describe(java.io.InputStream, org.eclipse.core.runtime.content.IContentDescription)
-
-