Example usage for org.apache.commons.io.input TaggedInputStream throwIfCauseOf

List of usage examples for org.apache.commons.io.input TaggedInputStream throwIfCauseOf

Introduction

In this page you can find the example usage for org.apache.commons.io.input TaggedInputStream throwIfCauseOf.

Prototype

public void throwIfCauseOf(Throwable throwable) throws IOException 

Source Link

Document

Re-throws the original exception thrown by this stream.

Usage

From source file:org.apache.tika.parser.rtf.RTFParser.java

public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)
        throws IOException, SAXException, TikaException {
    metadata.set(Metadata.CONTENT_TYPE, "application/rtf");
    TaggedInputStream tagged = new TaggedInputStream(stream);
    try {//from ww  w  . ja  v  a 2s  .c o  m
        XHTMLContentHandler xhtmlHandler = new XHTMLContentHandler(handler, metadata);
        RTFEmbObjHandler embObjHandler = new RTFEmbObjHandler(xhtmlHandler, metadata, context,
                getMemoryLimitInKb());
        final TextExtractor ert = new TextExtractor(xhtmlHandler, metadata, embObjHandler);
        ert.extract(stream);
    } catch (IOException e) {
        tagged.throwIfCauseOf(e);
        throw new TikaException("Error parsing an RTF document", e);
    }
}