@Service(value=ContentAwareMimeTypeService.class) @Properties(value={@Property(name="service.description",value="Apache Sling Content Aware MIME Type Service"),@Property(name="service.vendor",value="The Apache Software Foundation"),@Property(name="detection.mode",value="tika")}) public class ContentAwareMimeTypeServiceImpl extends Object implements ContentAwareMimeTypeService
Constructor and Description |
---|
ContentAwareMimeTypeServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
getExtension(String mimeType) |
String |
getMimeType(String name) |
String |
getMimeType(String filename,
InputStream content) |
void |
registerMimeType(InputStream mimeTabStream) |
void |
registerMimeType(String mimeType,
String... extensions) |
public String getMimeType(String filename, InputStream content) throws IOException, IllegalArgumentException
getMimeType
in interface ContentAwareMimeTypeService
filename
- Used if content
is null
or if
this service does not support content-based detectioncontent
- Optional stream that points to the content to analyze,
must support mark/reset.IOException
- if there's a problem reading the contentStreamIllegalArgumentException
- if contentStream does not support mark/resetpublic String getMimeType(String name)
getMimeType
in interface org.apache.sling.commons.mime.MimeTypeService
public String getExtension(String mimeType)
getExtension
in interface org.apache.sling.commons.mime.MimeTypeService
public void registerMimeType(String mimeType, String... extensions)
registerMimeType
in interface org.apache.sling.commons.mime.MimeTypeService
public void registerMimeType(InputStream mimeTabStream) throws IOException
registerMimeType
in interface org.apache.sling.commons.mime.MimeTypeService
IOException
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.