|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.datamodel.ifs.MCRFileContentTypeFactory
public class MCRFileContentTypeFactory
Provides methods to get the file content type with a given ID, or to detect
the file content type by providing file content header and filename.
The list of known file content types is defined in an XML file that is
specified in the property
MCR.IFS.FileContentTypes.DefinitionFile, and that file is
searched in the CLASSPATH directories or JAR files.
The class that implements the file content type detector must be specified by
the configuration property
MCR.IFS.FileContentTypes.DetectorClass.
| Field Summary | |
|---|---|
protected static MCRFileContentType |
defaultType
The default file content type if unknown |
protected static MCRFileContentTypeDetector |
detector
The file content type detector implementation that is used |
protected static Hashtable |
typesTable
Table for looking up all file content types by ID |
| Constructor Summary | |
|---|---|
MCRFileContentTypeFactory()
|
|
| Method Summary | |
|---|---|
static MCRFileContentType |
detectType(String filename,
byte[] header)
Detects the file content type from filename and file content header. |
static MCRFileContentType |
getDefaultType()
Returns the default file content type to be used if content type is unknown |
static MCRFileContentType |
getType(String ID)
Returns the file content type with the given ID |
static boolean |
isTypeAvailable(String ID)
Returns true if the file content type with the given ID is configured |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Hashtable typesTable
protected static MCRFileContentType defaultType
protected static MCRFileContentTypeDetector detector
| Constructor Detail |
|---|
public MCRFileContentTypeFactory()
| Method Detail |
|---|
public static MCRFileContentType getType(String ID)
throws MCRConfigurationException
ID - The non-null ID of the content type that should be returned
MCRConfigurationException - if no such file content type is known in the system
public static boolean isTypeAvailable(String ID)
throws MCRConfigurationException
ID - The non-null ID of the content type that should be returned
MCRConfigurationExceptionpublic static MCRFileContentType getDefaultType()
public static MCRFileContentType detectType(String filename,
byte[] header)
filename - the name of the file, may be nullheader - the first bytes of the file header, may be null or empty
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||