public class MimeTypesReader extends DefaultHandler implements MimeTypesReaderMetKeys
<!DOCTYPE mime-info [ <!ELEMENT mime-info (mime-type)+> <!ATTLIST mime-info xmlns CDATA #FIXED "http://www.freedesktop.org/standards/shared-mime-info"> <!ELEMENT mime-type (comment|acronym|expanded-acronym|glob|magic|root-XML|alias|sub-class-of)*> <!ATTLIST mime-type type CDATA #REQUIRED> <!-- a comment describing a document with the respective MIME type. Example: "WMV video" --> <!ELEMENT _comment (#PCDATA)> <!ATTLIST _comment xml:lang CDATA #IMPLIED> <!-- a comment describing a the respective unexpanded MIME type acronym. Example: "WMV" --> <!ELEMENT acronym (#PCDATA)> <!ATTLIST acronym xml:lang CDATA #IMPLIED> <!-- a comment describing a the respective unexpanded MIME type acronym. Example: "Windows Media Video" --> <!ELEMENT expanded-acronym (#PCDATA)> <!ATTLIST expanded-acronym xml:lang CDATA #IMPLIED> <!ELEMENT glob EMPTY> <!ATTLIST glob pattern CDATA #REQUIRED> <!ATTLIST glob isregex CDATA #IMPLIED> <!ELEMENT magic (match)+> <!ATTLIST magic priority CDATA #IMPLIED> <!ELEMENT match (match)*> <!ATTLIST match offset CDATA #REQUIRED> <!ATTLIST match type (string|big16|big32|little16|little32|host16|host32|byte) #REQUIRED> <!ATTLIST match value CDATA #REQUIRED> <!ATTLIST match mask CDATA #IMPLIED> <!ELEMENT root-XML EMPTY> <!ATTLIST root-XML namespaceURI CDATA #REQUIRED localName CDATA #REQUIRED> <!ELEMENT alias EMPTY> <!ATTLIST alias type CDATA #REQUIRED> <!ELEMENT sub-class-of EMPTY> <!ATTLIST sub-class-of type CDATA #REQUIRED> ]>In addition to the standard fields, this will also read two Tika specific fields: - link - uti
Modifier and Type | Field and Description |
---|---|
protected StringBuilder |
characters |
protected int |
priority |
protected MimeType |
type
Current type
|
protected MimeTypes |
types |
ACRONYM_TAG, ALIAS_TAG, ALIAS_TYPE_ATTR, COMMENT_TAG, GLOB_TAG, INTERPRETED_ATTR, ISREGEX_ATTR, LOCAL_NAME_ATTR, MAGIC_PRIORITY_ATTR, MAGIC_TAG, MATCH_MASK_ATTR, MATCH_MINSHOULDMATCH_ATTR, MATCH_OFFSET_ATTR, MATCH_TAG, MATCH_TYPE_ATTR, MATCH_VALUE_ATTR, MIME_INFO_TAG, MIME_TYPE_TAG, MIME_TYPE_TYPE_ATTR, NS_URI_ATTR, PATTERN_ATTR, ROOT_XML_TAG, SUB_CLASS_OF_TAG, SUB_CLASS_TYPE_ATTR, TIKA_LINK_TAG, TIKA_UTI_TAG
Modifier | Constructor and Description |
---|---|
protected |
MimeTypesReader(MimeTypes types) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endElement(String uri,
String localName,
String qName) |
protected void |
handleGlobError(MimeType type,
String pattern,
MimeTypeException ex,
String qName,
Attributes attributes) |
protected void |
handleMimeError(String input,
MimeTypeException ex,
String qName,
Attributes attributes) |
void |
read(Document document) |
void |
read(InputStream stream) |
InputSource |
resolveEntity(String publicId,
String systemId) |
static void |
setPoolSize(int poolSize)
Set the pool size for cached XML parsers.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes) |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
protected final MimeTypes types
protected MimeType type
protected int priority
protected StringBuilder characters
protected MimeTypesReader(MimeTypes types)
public void read(InputStream stream) throws IOException, MimeTypeException
IOException
MimeTypeException
public void read(Document document) throws MimeTypeException
MimeTypeException
public InputSource resolveEntity(String publicId, String systemId)
resolveEntity
in interface EntityResolver
resolveEntity
in class DefaultHandler
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName)
endElement
in interface ContentHandler
endElement
in class DefaultHandler
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
characters
in class DefaultHandler
protected void handleMimeError(String input, MimeTypeException ex, String qName, Attributes attributes) throws SAXException
SAXException
protected void handleGlobError(MimeType type, String pattern, MimeTypeException ex, String qName, Attributes attributes) throws SAXException
SAXException
public static void setPoolSize(int poolSize) throws TikaException
poolSize
- TikaException
Copyright © 2007–1969 The Apache Software Foundation. All rights reserved.