public class AutoDetectParser extends CompositeParser
Constructor and Description |
---|
AutoDetectParser()
Creates an auto-detecting parser instance using the default Tika
configuration.
|
AutoDetectParser(Detector detector) |
AutoDetectParser(Detector detector,
Parser... parsers) |
AutoDetectParser(Parser... parsers)
Creates an auto-detecting parser instance using the specified set of parser.
|
AutoDetectParser(TikaConfig config) |
Modifier and Type | Method and Description |
---|---|
Detector |
getDetector()
Returns the type detector used by this parser to auto-detect the type
of a document.
|
void |
parse(InputStream stream,
ContentHandler handler,
Metadata metadata)
Calls the
Parser.parse(InputStream, ContentHandler, Metadata, ParseContext)
method with an empty ParseContext . |
void |
parse(InputStream stream,
ContentHandler handler,
Metadata metadata,
ParseContext context)
Delegates the call to the matching component parser.
|
void |
setDetector(Detector detector)
Sets the type detector used by this parser to auto-detect the type
of a document.
|
findDuplicateParsers, getAllComponentParsers, getFallback, getMediaTypeRegistry, getParser, getParser, getParsers, getParsers, getSupportedTypes, setFallback, setMediaTypeRegistry, setParsers
public AutoDetectParser()
public AutoDetectParser(Detector detector)
public AutoDetectParser(Parser... parsers)
parsers
- public AutoDetectParser(TikaConfig config)
public Detector getDetector()
public void setDetector(Detector detector)
detector
- type detectorpublic void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
CompositeParser
Potential RuntimeException
s, IOException
s and
SAXException
s unrelated to the given input stream and content
handler are automatically wrapped into TikaException
s to better
honor the Parser
contract.
parse
in interface Parser
parse
in class CompositeParser
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 void parse(InputStream stream, ContentHandler handler, Metadata metadata) throws IOException, SAXException, TikaException
AbstractParser
Parser.parse(InputStream, ContentHandler, Metadata, ParseContext)
method with an empty ParseContext
. This method exists as a
leftover from Tika 0.x when the three-argument parse() method still
existed in the Parser
interface. No new code should call this
method anymore, it's only here for backwards compatibility.parse
in class AbstractParser
IOException
SAXException
TikaException
Copyright © 2007–1969 The Apache Software Foundation. All rights reserved.