List of usage examples for org.apache.commons.io.input TaggedInputStream TaggedInputStream
public TaggedInputStream(InputStream proxy)
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); } }