Class TikaMimeTypeProvider
- java.lang.Object
-
- org.apache.sling.commons.mime.internal.TikaMimeTypeProvider
-
- All Implemented Interfaces:
MimeTypeProvider
public class TikaMimeTypeProvider extends java.lang.Object implements MimeTypeProvider
MIME type provider based on Apache Tika.
-
-
Constructor Summary
Constructors Constructor Description TikaMimeTypeProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetExtension(java.lang.String mimeType)Returns the primary name extension to which the givenmimeTypemaps.java.lang.StringgetMimeType(java.lang.String name)Returns the MIME type of the extension of the givenname.
-
-
-
Method Detail
-
getMimeType
public java.lang.String getMimeType(java.lang.String name)
Description copied from interface:MimeTypeProviderReturns the MIME type of the extension of the givenname. The extension is the part of the name after the last dot. If the name does not contain a dot, the name as a whole is assumed to be the extension.- Specified by:
getMimeTypein interfaceMimeTypeProvider- Parameters:
name- The name for which the MIME type is to be returned.- Returns:
- The MIME type for the extension of the name. If the extension
cannot be mapped to a MIME type or
nameisnull,nullis returned. - See Also:
MimeTypeProvider.getExtension(String)
-
getExtension
public java.lang.String getExtension(java.lang.String mimeType)
Description copied from interface:MimeTypeProviderReturns the primary name extension to which the givenmimeTypemaps. The returned extension must map to the givenmimeTypewhen fed to theMimeTypeProvider.getMimeType(String)method. In other words, the expressionmimeType.equals(getMimeType(getExtension(mimeType)))must always betruefor any non-nullMIME type.A MIME type may be mapped to multiple extensions (e.g.
text/plaintotxt,log, ...). This method is expected to returned one of those extensions. It is up to the implementation to select an appropriate extension if multiple mappings exist for a single MIME type.- Specified by:
getExtensionin interfaceMimeTypeProvider- Parameters:
mimeType- The MIME type whose primary extension is requested.- Returns:
- A extension which maps to the given MIME type or
nullif no such mapping exists. - See Also:
MimeTypeProvider.getMimeType(String)
-
-