public class ParserDecorator extends AbstractParser
Parser interface. This class
simply delegates all parsing calls to an underlying decorated parser
instance. Subclasses can provide extra decoration by overriding the
parse method.| Constructor and Description |
|---|
ParserDecorator(Parser parser)
Creates a decorator for the given parser.
|
| Modifier and Type | Method and Description |
|---|---|
Set<MediaType> |
getSupportedTypes(ParseContext context)
Delegates the method call to the decorated parser.
|
Parser |
getWrappedParser()
Gets the parser wrapped by this ParserDecorator
|
void |
parse(InputStream stream,
ContentHandler handler,
Metadata metadata,
ParseContext context)
Delegates the method call to the decorated parser.
|
static Parser |
withTypes(Parser parser,
Set<MediaType> types)
Decorates the given parser so that it always claims to support
parsing of the given media types.
|
parsepublic ParserDecorator(Parser parser)
parser - the parser instance to be decoratedpublic static final Parser withTypes(Parser parser, Set<MediaType> types)
parser - the parser to be decoratedtypes - supported media typespublic Set<MediaType> getSupportedTypes(ParseContext context)
super.getSupportedTypes()
to invoke the decorated parser) to implement extra decoration.context - parse contextpublic void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
super.parse() to invoke
the decorated parser) to implement extra decoration.stream - the document stream (input)handler - handler for the XHTML SAX events (output)metadata - document metadata (input and output)context - parse contextIOException - if the document stream could not be readSAXException - if the SAX events could not be processedTikaException - if the document could not be parsedpublic Parser getWrappedParser()
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.