|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.graph.mimetype.MimeTypeDetectors
@ThreadSafe public final class MimeTypeDetectors

Facility for managing MimeTypeDetectorConfigs.
| Field Summary | |
|---|---|
protected static ClassLoaderFactory |
DEFAULT_CLASSLOADER_FACTORY
Class loader factory instance that always returns the current thread's context class
loader, or if null the class loader for this class. |
static String |
DEFAULT_MIME_TYPE
|
| Constructor Summary | |
|---|---|
MimeTypeDetectors()
|
|
| Method Summary | |
|---|---|
boolean |
addDetector(MimeTypeDetectorConfig config)
Adds the configuration for a MIME-type detector before any previously added configurations, or updates any existing one that represents the same configuration |
ClassLoaderFactory |
getClassLoaderFactory()
Gets the class loader factory that should be used to load MIME-type detectors. |
Logger |
getLogger()
Gets the logger for this system |
String |
mimeTypeOf(String name,
InputStream content)
Returns the first non-null result of iterating over the registered MIME-type
detectors in the reverse order in which they were registered to determine the MIME-type of a data source, using its
supplied content and/or its supplied name, depending upon the implementation. |
boolean |
removeDetector(MimeTypeDetectorConfig config)
Removes the configuration for a MIME-type detector. |
void |
setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
Sets the Maven Repository that should be used to load the MIME-type detectors. |
void |
setLogger(Logger logger)
Sets the logger for this system. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_MIME_TYPE
protected static final ClassLoaderFactory DEFAULT_CLASSLOADER_FACTORY
current thread's context class
loader, or if null the class loader for this class.
| Constructor Detail |
|---|
public MimeTypeDetectors()
| Method Detail |
|---|
public boolean addDetector(MimeTypeDetectorConfig config)
same configuration
config - the new configuration; must not be null.
true if the detector was added, or false if there already was an existing detector
configuration.removeDetector(MimeTypeDetectorConfig)public ClassLoaderFactory getClassLoaderFactory()
current thread's context class loader, or if
null the class loader for this class.
nullsetClassLoaderFactory(ClassLoaderFactory)public Logger getLogger()
public String mimeTypeOf(String name,
InputStream content)
throws IOException
registered MIME-type
detectors in the reverse order in which they were registered to determine the MIME-type of a data source, using its
supplied content and/or its supplied name, depending upon the implementation. If the MIME-type cannot be determined by any
registered detector, "text/plain" or "application/octet-stream" will be returned, the former only if it is determined the
stream contains no nulls.
mimeTypeOf in interface MimeTypeDetectorname - The name of the data source; may be null.content - The content of the data source; may be null.
null.
IOException - If an error occurs reading the supplied content.public boolean removeDetector(MimeTypeDetectorConfig config)
config - the configuration to be removed; must not be null.
true if the configuration was removed, or false if there was no existing configurationaddDetector(MimeTypeDetectorConfig)public void setClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
current thread's context class loader, or if
null the class loader for this class.
classLoaderFactory - the class loader factory, or null if the default class loader factory should be
used.getClassLoaderFactory()public void setLogger(Logger logger)
logger - the logger, or null if the standard logging should be used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||