|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 | |
|---|---|
static MimeTypeDetectorConfig |
CONFIGURATION
A default configuration that may be used to add the
ExtensionBasedMimeTypeDetector to a MimeTypeDetector instance. |
| 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 |
| Field Detail |
|---|
public static final MimeTypeDetectorConfig CONFIGURATION
add the
ExtensionBasedMimeTypeDetector to a MimeTypeDetector instance.
| Constructor Detail |
|---|
public ExtensionBasedMimeTypeDetector()
org/modeshape/mime.types" classpath resource.
public ExtensionBasedMimeTypeDetector(Map<String,String> extensionsToMimeTypes)
org/modeshape/mime.types"
classpath resource, but the supplied extension mappings override any default mappings.
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 used
public 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 first| Method 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 MimeTypeDetectorname - 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 | |||||||||