Hello, Andrea.

As Tika o.a.tika.parser.Parser#parse javadoc says Parser consumes stream
and you have to close it after.
Some parsers (e.g. AutoDetectParser) can invalidate you mark by using
mark/reset internally, so reset will throw an exception you get.

Better way is to reopen input stream source (if it's a file or an URL) or
buffer it to disk if it is an external stream which is not recreatable (or
just too expencive to reopen).


ср, 30 сент. 2015 г. в 16:34, Andrea Asta <[email protected]>:

> Hi,
> I'm trying to implement a sort of fallback parser for PDF: I want to use
> the default PDF parser and, checking the result, decide to call a different
> custom parser.
> When I try to call the reset() method on the TikaInputStream, I get an
> exception like this:
>
> Caused by: java.io.IOException: Resetting to invalid mark
>
> at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
>
> at org.apache.tika.io.ProxyInputStream.reset(ProxyInputStream.java:168)
>
>
> Is it correct to call the reset() method or should I do something
> different before calling a parse method on the same stream? Or is that
> impossibile?
>
>
> Thank you
>
> Andrea
>
-- 
Best regards,
Konstantin Gribov

Reply via email to