@Override
    public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {
        TemporaryResources tmp = new TemporaryResources();
        TikaInputStream tis = TikaInputStream.get(stream, tmp, metadata);
        try {
            if (shouldDigest(metadata)) {
                digester.digest(tis, metadata, context);
            }
            super.parse(tis, handler, metadata, context);
        } finally {
            tmp.dispose();
        }
    }
Creates a decorator for the given parser.

@param parser the parser instance to be decorated
tika-core/src/main/java/org/apache/tika/parser/DigestingParser.java