[
https://issues.apache.org/jira/browse/TIKA-2849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16823084#comment-16823084
]
Tim Allison commented on TIKA-2849:
-----------------------------------
For {{POIFSContainerDetector}}, I followed Jukka's recommendation, and I may
have gotten it right. :D
a) If there is an underlying file in the {{TikaInputStream}}, use that for
detection (the file is loaded by POI)
b) If the {{TikaInputStream}} wraps an {{InputStream}}, spool up to
{{markLimit}} to disk. If the amount spooled is less than {{markLimit}}, i.e.,
if the file size is less than {{markLimit}}...meaning the entire file has been
spooled... POI opens the non-truncated file. If the amount spooled is equal to
{{markLimit}} (i.e. we only spooled part of the file) do not detect.
For now, I've kept the legacy behavior, that {{POIFSContainerDetector}} does
not try to do detection on a non-TikaInputStream.
> TikaInputStream copies the input stream locally
> -----------------------------------------------
>
> Key: TIKA-2849
> URL: https://issues.apache.org/jira/browse/TIKA-2849
> Project: Tika
> Issue Type: Bug
> Affects Versions: 1.20
> Reporter: Boris Petrov
> Assignee: Tim Allison
> Priority: Major
> Fix For: 1.21
>
>
> When doing "tika.detect(stream, name)" and the stream is a "TikaInputStream",
> execution gets to "TikaInputStream#getPath" which does a "Files.copy(in,
> path, REPLACE_EXISTING);" which is very, very bad. This input stream could
> be, as in our case, an input stream from a network file which is tens or
> hundreds of gigabytes large. Copying it locally is a huge waste of resources
> to say the least. Why does it do that and can I make it not do it? Or is this
> something that has to be fixed in Tika?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)