Interface ContentAwareMimeTypeService
-
- All Superinterfaces:
MimeTypeService
public interface ContentAwareMimeTypeService extends MimeTypeService
TheContentAwareMimeTypeService
interface extends theMimeTypeService
API for services which can detect mime types based on the content passed to them.The implementing services should rely on analyzing the content to ascertain the mime type. This interface may be implemented by bundles wishing to provide a mechanism to detect mime type based on the contents.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getMimeType(java.lang.String filename, java.io.InputStream contentStream)
-
Methods inherited from interface org.apache.sling.commons.mime.MimeTypeService
getExtension, getExtensionMap, getMimeMap, getMimeType, registerMimeType, registerMimeType
-
-
-
-
Method Detail
-
getMimeType
java.lang.String getMimeType(java.lang.String filename, java.io.InputStream contentStream) throws java.io.IOException, java.lang.IllegalArgumentException
- Parameters:
filename
- Used ifcontent
isnull
or if this service does not support content-based detectioncontentStream
- Optional stream that points to the content to analyze, must support mark/reset.- Returns:
- the mime type
- Throws:
java.lang.IllegalArgumentException
- if contentStream does not support mark/resetjava.io.IOException
- if there's a problem reading the contentStream
-
-