|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.common.util.MimeTypeUtil org.modeshape.graph.mimetype.ExtensionBasedMimeTypeDetector
@Immutable public class ExtensionBasedMimeTypeDetector
A MimeTypeDetector
that attempts to match the extension of the supplied name against a set of known file extensions.
Field Summary |
---|
Fields inherited from class org.modeshape.common.util.MimeTypeUtil |
---|
MIME_TYPE_EXTENSIONS_RESOURCE_PATH |
Constructor Summary | |
---|---|
ExtensionBasedMimeTypeDetector()
Create a default instance of the extension-based MIME type detector. |
|
ExtensionBasedMimeTypeDetector(Map<String,String> extensionsToMimeTypes)
Create an instance of the extension-based MIME type detector by using the supplied mappings. |
|
ExtensionBasedMimeTypeDetector(Map<String,String> extensionsToMimeTypes,
boolean initWithDefaults)
Create an instance of the extension-based MIME type detector by using the supplied mappings. |
Method Summary | |
---|---|
String |
mimeTypeOf(String name,
InputStream content)
Returns the MIME-type of a data source, using its supplied content and/or its supplied name, depending upon the implementation. |
Methods inherited from class org.modeshape.common.util.MimeTypeUtil |
---|
getDefaultMappings, load, mimeTypeOf, mimeTypeOf |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionBasedMimeTypeDetector()
public ExtensionBasedMimeTypeDetector(Map<String,String> extensionsToMimeTypes)
extensionsToMimeTypes
- the mapping of extension patterns to MIME types, which will override the default mappings; may
be null if the default mappings are to be usedpublic ExtensionBasedMimeTypeDetector(Map<String,String> extensionsToMimeTypes, boolean initWithDefaults)
extensionsToMimeTypes
- the mapping of extension patterns to MIME types, which will override the default mappings; may
be null if the default mappings are to be usedinitWithDefaults
- true if the default mappings are to be loaded firstMethod Detail |
---|
public String mimeTypeOf(String name, InputStream content)
null
may be returned,
where the former will prevent earlier registered MIME-type detectors from being consulted.
Note that detector implementations should not close
the supplied input stream.
mimeTypeOf
in interface MimeTypeDetector
name
- The name of the data source; may be null
.content
- The content of the data source; may be null
.
null
if the MIME-type could not be determined.MimeTypeDetector.mimeTypeOf(java.lang.String, java.io.InputStream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |