Hi,

On Tue, Aug 3, 2010 at 4:22 PM, Chris Bamford <[email protected]> wrote:
> I recently (in the last couple of months) compiled my code against version
> 0.8-SNAPSHOT of tika-app. Today it no longer compiles because the 
> isDescendantOf()
> method of the MimeTypes class has gone.

Sorry about that. I've been working on cleaning up our type handling
code. If you need this method, I'll restore it as a deprecated method
for now.

> Could someone please advise on the replacement? Here is my code for context:

See the new MediaTypeRegistry class. An alternative version of your
code could be:

    boolean isEqualOrSpecializationOf(String type, String parent) {
        MediaTypeRegistry registry = MediaTypeRegistry.getDefaultRegistry();
        MediaType a = registry.normalize(MediaType.parse(type));
        MediaType b = registry.normalize(MediaType.parse(parent));
        return a.equals(b) || registry.isSpecializationOf(a, b);
    }

PS. This and other details about media type handling in Tika is
available in chapter 4 of the Tika in Action book
(http://www.manning.com/mattmann/) I'm currently writing with Chris
Mattmann.

BR,

Jukka Zitting

Reply via email to