org.apache.sling.commons.contentdetection.internal

## Class ContentAwareMimeTypeServiceImpl

- java.lang.Object
- - org.apache.sling.commons.contentdetection.internal.ContentAwareMimeTypeServiceImpl

All Implemented Interfaces:
  ContentAwareMimeTypeService, org.apache.sling.commons.mime.MimeTypeService

    public class ContentAwareMimeTypeServiceImpl
    extends Object
    implements ContentAwareMimeTypeService

### Constructor Summary

Constructors
Constructor and Description
`ContentAwareMimeTypeServiceImpl()`

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getExtension(String mimeType)`
`String` `getMimeType(String name)`
`String` `getMimeType(String filename, InputStream content)`
`void` `registerMimeType(InputStream mimeTabStream)`
`void` `registerMimeType(String mimeType, String... extensions)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ContentAwareMimeTypeServiceImpl

    public ContentAwareMimeTypeServiceImpl()

### Method Detail

#### getMimeType

    public String getMimeType(String filename,
                              InputStream content)
                       throws IOException,
                              IllegalArgumentException

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

#### getMimeType

    public String getMimeType(String name)

Specified by:
  `getMimeType` in interface `org.apache.sling.commons.mime.MimeTypeService`

#### getExtension

    public String getExtension(String mimeType)

Specified by:
  `getExtension` in interface `org.apache.sling.commons.mime.MimeTypeService`

#### registerMimeType

    public void registerMimeType(String mimeType,
                                 String... extensions)

Specified by:
  `registerMimeType` in interface `org.apache.sling.commons.mime.MimeTypeService`

#### registerMimeType

    public void registerMimeType(InputStream mimeTabStream)
                          throws IOException

Specified by:
  `registerMimeType` in interface `org.apache.sling.commons.mime.MimeTypeService`
Throws:
  `IOException`