public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {
        Parser parser = getParser(metadata, context);
        TemporaryResources tmp = new TemporaryResources();
        ParseRecord parserRecord = context.get(ParseRecord.class);
        if (parserRecord == null) {
            parserRecord = new ParseRecord();
            context.set(ParseRecord.class, parserRecord);
        }
        try {
            TikaInputStream taggedStream = TikaInputStream.get(stream, tmp, metadata);
            TaggedContentHandler taggedHandler =
                    handler != null ? new TaggedContentHandler(handler) : null;
            String parserClassname = ParserUtils.getParserClassname(parser);
            parserRecord.addParserClass(parserClassname);
            ParserUtils.recordParserDetails(parserClassname, metadata);
            parserRecord.beforeParse();
            try {
                parser.parse(taggedStream, taggedHandler, metadata, context);
            } catch (SecurityException e) {
                //rethrow security exceptions
                throw e;
            } catch (IOException e) {
                taggedStream.throwIfCauseOf(e);
                throw new TikaException("TIKA-198: Illegal IOException from " + parser, e);
            } catch (SAXException e) {
                WriteLimitReachedException.throwIfWriteLimitReached(e);
                if (taggedHandler != null) {
                    taggedHandler.throwIfCauseOf(e);
                }
                throw new TikaException("TIKA-237: Illegal SAXException from " + parser, e);
            } catch (RuntimeException e) {
                throw new TikaException("Unexpected RuntimeException from " + parser, e);
            }
        } finally {
            tmp.dispose();
            parserRecord.afterParse();
            if (parserRecord.getDepth() == 0) {
                metadata.set(TikaCoreProperties.TIKA_PARSED_BY_FULL_SET, parserRecord.getParsers());
                recordEmbeddedMetadata(metadata, context);
            }
        }
    }
Delegates the call to the matching component parser.
<p>
Potential {@link RuntimeException}s, {@link IOException}s and
{@link SAXException}s unrelated to the given input stream and content
handler are automatically wrapped into {@link TikaException}s to better
honor the {@link Parser} contract.
tika-core/src/main/java/org/apache/tika/parser/CompositeParser.java