tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Burch (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TIKA-653) Can't detected MimeType from FileInputStream
Date Tue, 03 May 2011 10:28:03 GMT

    [ https://issues.apache.org/jira/browse/TIKA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028143#comment-13028143
] 

Nick Burch commented on TIKA-653:
---------------------------------

If you have a File object, then using a TikaInputStream might well be a better bet for you

However, the exception you're getting does look like a problem with the file/os, rather than
Tika...

> 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

Mime
View raw message