commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Härnvi <j...@harnvi.net>
Subject Re: JMimeMagic (was [fileUpload] file content-type)
Date Wed, 19 Apr 2006 06:46:36 GMT

Hi!

> Starting from scratch would be possibly the best anyway. I had it also on my todo list
on a very low priority ... but just, because I found that jMimeMagic has a really worse implemenattion
- extremly slow and not working correctly. I have a good pile of image files it does not detect.
Main reason is, that the implementation is simply wrong. The original magic files have a clear
idea of precedence of patterns - this has been lost completely in the conversion/implementation
of jMimeMagic.
>
> - Jörg
>   

Using the original magic file and parse it in Java also makes it easier 
to keep it updated. Just add the newest magic file to the jar file and 
we are done.

I have a (pretty C-like) Python port of file(1). Maybe that can be of 
some help, implementing it in Java. I don't know about the license of 
that code though.

The C implementation can be found here:

http://www.opensource.apple.com/darwinsource/Current/file-6/file/src/

The meat is in softmagic.c.  It under a BSD license.

    /Markus

Mime
View raw message