Hi,

On 04/03/2011 06:07 PM, Oleg Tikhonov wrote:
One of the possible solutions is to create temporary file, pass it to
the citor and delete it after using.

As noted by Nick on the issue, a better alternative is to use
TikaInputStream as it automatically takes care of creating and removing the temporary file if needed.

The relevant code within a parse() method should look something like this:

    TemporaryFiles tmp = new TemporaryFiles();
    try {
        TikaInputStream tis = TikaInputStream.get(stream, tmp);
        File file = tis.getFile();
        ...; // process the file
    } finally {
        tmp.dispose();
    }

See the TikaInputStream and TemporaryFiles javadocs for the details.

--
Jukka Zitting

Reply via email to