Can't detected MimeType from FileInputStream
--------------------------------------------
Key: TIKA-653
URL: https://issues.apache.org/jira/browse/TIKA-653
Project: Tika
Issue Type: Bug
Affects Versions: 0.9
Reporter: Sascha Rodekamp
Hi,
i have a problem with the detection of the mime type from an file input stream.
It always throws an IO Exception. I tried to wrap the FileInputStream in a
BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
{code}
Exception: java.io.IOException
Message: Read error
---- stack trace ---------------------------------------------------------------
java.io.IOException: Read error
java.io.FileInputStream.readBytes(Native Method)
java.io.FileInputStream.read(FileInputStream.java:199)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
java.io.FilterInputStream.read(FilterInputStream.java:90)
org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
org.apache.tika.Tika.detect(Tika.java:132)
org.apache.tika.Tika.detect(Tika.java:155)
{code}
It works great with a ByteArrayInputStream.
MyCode to get the MimeType from the InputStream is:
{code}
if (!is.markSupported()) {
is = new BufferedInputStream(is);
}
Tika tika = new Tika();
try {
return tika.detect(is);
}
.....
{code}
Is this a bug in the library or my fault?
any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira