You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Jakub Liska <li...@gmail.com> on 2011/07/24 17:05:57 UTC
How to get extension from MediaType
Hey,
currently it is only possibly to getExtension from MimeType. But there
is no way of getting MimeType from already detected MediaType, to get
the file extension. Could please anybody help me out ?
Re: How to get extension from MediaType
Posted by Jakub Liska <li...@gmail.com>.
Thanks Nick, I wasn't looking properly
tikaConfig.getMimeRepository().forName(mediaType.toString());
On Sun, Jul 24, 2011 at 9:59 PM, Jakub Liska <li...@gmail.com> wrote:
> but MimeTypes.getMimeType( ); methods are all deprecated, saying you
> should use Tika.detect( ), that returns String that you can use to get
> MediaType MediaType.parse(string);
>
> I was really searching through the entire code base how to get
> MimeType without it being deprecated and I didn't find anything.
>
> On Sun, Jul 24, 2011 at 6:48 PM, Nick Burch <ni...@alfresco.com> wrote:
>> On Sun, 24 Jul 2011, Jakub Liska wrote:
>>>
>>> currently it is only possibly to getExtension from MimeType. But there
>>> is no way of getting MimeType from already detected MediaType, to get
>>> the file extension.
>>
>> Start with your TikaConfig, and call getMimeRepository() to get the
>> MimeTypes. From there you should be able to lookup the MimeType for a
>> MediaType
>>
>> Nick
>>
>
Re: How to get extension from MediaType
Posted by Jakub Liska <li...@gmail.com>.
but MimeTypes.getMimeType( ); methods are all deprecated, saying you
should use Tika.detect( ), that returns String that you can use to get
MediaType MediaType.parse(string);
I was really searching through the entire code base how to get
MimeType without it being deprecated and I didn't find anything.
On Sun, Jul 24, 2011 at 6:48 PM, Nick Burch <ni...@alfresco.com> wrote:
> On Sun, 24 Jul 2011, Jakub Liska wrote:
>>
>> currently it is only possibly to getExtension from MimeType. But there
>> is no way of getting MimeType from already detected MediaType, to get
>> the file extension.
>
> Start with your TikaConfig, and call getMimeRepository() to get the
> MimeTypes. From there you should be able to lookup the MimeType for a
> MediaType
>
> Nick
>
Re: How to get extension from MediaType
Posted by Nick Burch <ni...@alfresco.com>.
On Sun, 24 Jul 2011, Jakub Liska wrote:
> currently it is only possibly to getExtension from MimeType. But there
> is no way of getting MimeType from already detected MediaType, to get
> the file extension.
Start with your TikaConfig, and call getMimeRepository() to get the
MimeTypes. From there you should be able to lookup the MimeType for a
MediaType
Nick