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

Jukka Zitting commented on TIKA-1217:
-------------------------------------

Thanks! I committed the patch in revision 1557795.

Before we resolve this as fixed, I think it would be better to use 
{{detect(File)}} directly, without first trying type detection based on just 
the file name. Name-based type lookup is less accurate than file-based, and 
AFAICT there are few applications where  file type lookup is 
performance-critical (and if it is, like in a directory browser, the results 
are often cached). And assuming the file-based lookup was conditional on the 
existence of the file, a client could still do name-only lookups by prepending 
a fictional directory name to the path passed to the {{probeContentType()}} 
call. WDYT?

> Integrate with Java-7 FileTypeDetector API
> ------------------------------------------
>
>                 Key: TIKA-1217
>                 URL: https://issues.apache.org/jira/browse/TIKA-1217
>             Project: Tika
>          Issue Type: New Feature
>          Components: detector, mime
>            Reporter: Peter Ansell
>         Attachments: TIKA-1217-v2.patch, TIKA-1217.patch
>
>
> It would be useful if Tika natively provided Java-7 FileTypeDetector [1] 
> implementations. Adding the corresponding 
> META-INF/services/java.nio.file.spi.FileTypeDetector files would allow the 
> use of Files.probeContentType [2] without any specific links to Tika for this 
> functionality.
> If you do not want to rely on Java-7 for the core, then this could be added 
> as an extension module.
> [1] 
> http://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/FileTypeDetector.html
> [2] 
> http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#probeContentType(java.nio.file.Path)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to