|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.datamodel.ifs.MCRSimpleFCTDetector
public class MCRSimpleFCTDetector
A simple implementation of an MCRFileContentTypeDetector, detects the file type based on the filename extension and a magic bytes pattern at some offset in the header of the file's content. The rules for detecting each file type are embedded in the <rules> element of the file content types definition XML file.
MCRFileContentTypeDetector,
MCRFileContentType,
MCRFileContentTypeFactory| Nested Class Summary | |
|---|---|
(package private) class |
MCRSimpleFCTDetector.MCRDetectionRule
Common superclass of different kinds of detection rules |
(package private) class |
MCRSimpleFCTDetector.MCRDoctypeRule
A rule that decides based on the doctype of a xml file |
(package private) class |
MCRSimpleFCTDetector.MCRExtensionRule
A rule that decides based on the file extension |
(package private) class |
MCRSimpleFCTDetector.MCRPatternRule
A rule that decides based on a magic bytes pattern that has to occur in the file header at a given offset |
(package private) class |
MCRSimpleFCTDetector.MCRStringRule
A rule that decides based on a String at any position in the head of the file |
| Constructor Summary | |
|---|---|
MCRSimpleFCTDetector()
Creates a new detector |
|
| Method Summary | |
|---|---|
void |
addRule(MCRFileContentType type,
Element xRules)
Adds a detection rule from the file content type definition XML file. |
MCRFileContentType |
detectType(String filename,
byte[] header)
Detects the file content type from filename and/or file header. |
protected String |
parseDocumentType(InputStream in)
Copy from MCRLayoutServlet, messages changed from MCRLayoutServlet to MCRSimpleFCTDetector Try to detect doctype of xml data |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MCRSimpleFCTDetector()
| Method Detail |
|---|
public void addRule(MCRFileContentType type,
Element xRules)
addRule in interface MCRFileContentTypeDetectortype - the file content type the rule is forxRules - the rules XML element containing the rules for detecting that
type
public MCRFileContentType detectType(String filename,
byte[] header)
MCRFileContentTypeDetector
detectType in interface MCRFileContentTypeDetectorfilename - the name of the fileheader - the first bytes of the file content
protected String parseDocumentType(InputStream in)
in - xml data
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||