public class CompositeParser extends AbstractParser
| Constructor and Description |
|---|
CompositeParser() |
CompositeParser(MediaTypeRegistry registry,
java.util.List<Parser> parsers) |
CompositeParser(MediaTypeRegistry registry,
java.util.List<Parser> parsers,
java.util.Collection<java.lang.Class<? extends Parser>> excludeParsers) |
CompositeParser(MediaTypeRegistry registry,
Parser... parsers) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<MediaType,java.util.List<Parser>> |
findDuplicateParsers(ParseContext context)
Utility method that goes through all the component parsers and finds
all media types for which more than one parser declares support.
|
java.util.List<Parser> |
getAllComponentParsers()
Returns all parsers registered with the Composite Parser,
including ones which may not currently be active.
|
Parser |
getFallback()
Returns the fallback parser.
|
MediaTypeRegistry |
getMediaTypeRegistry()
Returns the media type registry used to infer type relationships.
|
java.util.Map<MediaType,Parser> |
getParsers()
Returns the component parsers.
|
java.util.Map<MediaType,Parser> |
getParsers(ParseContext context) |
java.util.Set<MediaType> |
getSupportedTypes(ParseContext context)
Returns the set of media types supported by this parser when used
with the given parse context.
|
void |
parse(java.io.InputStream stream,
org.xml.sax.ContentHandler handler,
Metadata metadata,
ParseContext context)
Delegates the call to the matching component parser.
|
void |
setFallback(Parser fallback)
Sets the fallback parser.
|
void |
setMediaTypeRegistry(MediaTypeRegistry registry)
Sets the media type registry used to infer type relationships.
|
void |
setParsers(java.util.Map<MediaType,Parser> parsers)
Sets the component parsers.
|
parsepublic CompositeParser(MediaTypeRegistry registry, java.util.List<Parser> parsers, java.util.Collection<java.lang.Class<? extends Parser>> excludeParsers)
public CompositeParser(MediaTypeRegistry registry, java.util.List<Parser> parsers)
public CompositeParser(MediaTypeRegistry registry, Parser... parsers)
public CompositeParser()
public java.util.Map<MediaType,Parser> getParsers(ParseContext context)
public java.util.Map<MediaType,java.util.List<Parser>> findDuplicateParsers(ParseContext context)
context - parsing contextpublic MediaTypeRegistry getMediaTypeRegistry()
public void setMediaTypeRegistry(MediaTypeRegistry registry)
registry - media type registrypublic java.util.List<Parser> getAllComponentParsers()
public java.util.Map<MediaType,Parser> getParsers()
public void setParsers(java.util.Map<MediaType,Parser> parsers)
parsers - component parsers, keyed by media typepublic Parser getFallback()
public void setFallback(Parser fallback)
fallback - fallback parserpublic java.util.Set<MediaType> getSupportedTypes(ParseContext context)
Parsercontext - parse contextpublic void parse(java.io.InputStream stream,
org.xml.sax.ContentHandler handler,
Metadata metadata,
ParseContext context)
throws java.io.IOException,
org.xml.sax.SAXException,
TikaException
Potential RuntimeExceptions, IOExceptions and
SAXExceptions unrelated to the given input stream and content
handler are automatically wrapped into TikaExceptions to better
honor the Parser contract.
stream - the document stream (input)handler - handler for the XHTML SAX events (output)metadata - document metadata (input and output)context - parse contextjava.io.IOException - if the document stream could not be readorg.xml.sax.SAXException - if the SAX events could not be processedTikaException - if the document could not be parsedCopyright © 2010 - 2023 Adobe. All Rights Reserved