Discussions

News: Announcing the Release of mime-util-1.1

  1. Announcing the Release of mime-util-1.1 (7 messages)

    mime-util is a simple to use, small, light weight and fast open source java utility library that can detect the mime types of files and streams. Due to the use of regular expressions and the java.nio packages it requires at least Java 1.4. mime-util uses file extension mappings and the magic.mime rules files located on your system as used by the Unix file(1) command. For OS's that do not support the Unix file(1) command, such as Windows, the library comes pre-packaged with a generic magic.mime file. With this release we have improved the performance of the mime mapping algorithm and added the ability to highly customise the rules for mapping the mime types as well as added support for detecting the mime types of java streams as well. We have greatly improved the documentation and added a significant amount of javadoc to the source code. The project sources, documentation and jar files can be downloaded directly from the project web site at http://sourceforge.net/projects/mime-util/. The latest sources and unit tests are always available from the projects SVN repository if you need them. The mime-util Team.
  2. Congratulations!
  3. In addition to manually looking at the file extension and using the magic.mime file, you can also use: * ServletContext.getMimeType(String fileName) -- based on your web.xml section * URLConnection.guessContentTypeFromStream(InputStream is) -- hard-coded in the JDK * URLConnection.guessContentTypeFromName(String fileName) -- uses ${java.home}/lib/content-types.properties * javax.activation.FileTypeMap.getDefaultFileTypeMap().getContentType(String fileName) -- uses "mime.types" (needs javax.activation or Java >= 6), see javax.activation.MimetypesFileTypeMap As you can see, your proprietary file extension mapping file and Java's standard "mime.types" overlap, as they both use file extensions to determine the mime type. So your real value is the support for UNIX "magic.mime", greatly improving upon URLConnection.guessContentTypeFromStream(InputStream is) capabilities. Great work there! ________ MessAdmin, Java EE administration made easy!
  4. Take a look to Apache Tika that does the same thing. See AutoDetectParser class : http://lucene.apache.org/tika/apidocs/org/apache/tika/parser/AutoDetectParser.html
  5. Tika does not exactly address the same area as mime-util. mime-util deals exclusively with mime-type detection on any platform and in any environment i.e stand alone or in an application server. It's highly configurable and is ready to roll straight out of the box. Tika deals with meta data retrieval from documents, which can include mime types. However, Tika has a whole raft of dependencies and mime-util requires only commons-logging. This makes it a much lighter solution if your problem is mime detection. Steven McArdle
  6. Hi Cedrik Thanks for the words of encouragment regarding the integration with the Unix magic.mime files. With regard to the comparison with the other Java API methods you mentioned, we hope that mime-util supports more matching rules and therefor returns the correct mime type more frequently. mime-util is also more customisable and works in any environment including web servers, app server and standalone. Our long term goal is to turn mime-util into a world class one stop shop for mime detection. We have many plans for the 2.0 release that we are actively working on including globbing, seamless integration with the freedesktop.org shared-mime-info database and eclipse integration. But more on that later ;-) In the mean time we are looking after customer requests for more file extension mappings and custom magic.mime rules, Steven McArdle
  7. class file version[ Go to top ]

    I get this message when I try to build with it: cannot access eu.medsea.util.MimeUtil bad class file: repository/mime-util/mime-util/1.1/mime-util-1.1.jar(eu/medsea/util/MimeUtil.class) class file has wrong version 50.0, should be 49.0 Went back to 1.0 for now, but would really like the added ability to handle streams
  8. Re: class file version[ Go to top ]

    Hi, If you download the jar file directly from the project site you should not need to build it yourself. I will check the project build status tomorrow to see what the problem could be and commit any corrections if necessary to the 1.1 SVN repository. 1.1 is a worth while upgrade if you are currently using 1.0 and stream detection is a definite must for a lot of applications. Steven McArdle