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

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

Introduction

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

Prototype

public TaggedInputStream(InputStream proxy) 

Source Link

Document

Creates a tagging decorator for the given input 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  w w  w. jav a2 s .  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);
    }
}