Is there a way, to configure Apache Tika, to parse data in chunks ? Let's say Data is divided in 10 chunks. Can it parse each chunk as it receives it ? Or it can only parse when it gets all 10 chunks ?
public OutputStream parse(InputStream instream) {
OutputStream outstream = new ByteArrayOutputStream();
ToXMLContentHandler h = new ToXMLContentHandler();
AutoDetectParser parser = new AutoDetectParser();
ParseContext context = new ParseContext();
Metadata metadata = new Metadata();
XHTMLContentHandler h1 = new XHTMLContentHandler(h, metadata);
try {
parser.parse(instream, h1, metadata, context);
outstream.write(h1.toString().getBytes(Charset.forName("UTF-8")));
} catch (TikaException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return outstream;
}
Any ideas on this?