org.apache.sling.commons.contentdetection

## Interface ContentAwareMimeTypeService

All Superinterfaces:
  org.apache.sling.commons.mime.MimeTypeService

All Known Implementing Classes:
  ContentAwareMimeTypeServiceImpl

    public interface ContentAwareMimeTypeService
    extends org.apache.sling.commons.mime.MimeTypeService

The `ContentAwareMimeTypeService` interface extends the `MimeTypeService` 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
`String` `getMimeType(String filename, InputStream contentStream)`

### Methods inherited from interface org.apache.sling.commons.mime.MimeTypeService

`getExtension, getMimeType, registerMimeType, registerMimeType`

### Method Detail

#### getMimeType

    String getMimeType(String filename,
                       InputStream contentStream)
                throws IOException,
                       IllegalArgumentException

Parameters:
  `filename` - Used if `content` is `null` or if this service does not support content-based detection
  `contentStream` - Optional stream that points to the content to analyze, must support mark/reset.
Returns:
  the mime type
Throws:
  `IllegalArgumentException` - if contentStream does not support mark/reset
  `IOException` - if there's a problem reading the contentStream