org.mycore.datamodel.ifs
Interface MCRFileContentTypeDetector

All Known Implementing Classes:
MCRSimpleFCTDetector

public interface MCRFileContentTypeDetector

Detects the file content type from filename and file header. The rules to do this are implementation specific, but MyCoRe provides a simple detector implementation in the class MCRSimpleFCTDetector.

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Frank Lützenkirchen
See Also:
MCRSimpleFCTDetector

Method Summary
 void addRule(MCRFileContentType type, Element rules)
          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.
 

Method Detail

addRule

void addRule(MCRFileContentType type,
             Element rules)
Adds a detection rule from the file content type definition XML file. The detector is responsible for parsing the <rules> element provided and registering the rules stored there with the content type given.

Parameters:
type - the file content type the rule is for
rules - the rules XML element containing the rules for detecting that type

detectType

MCRFileContentType detectType(String filename,
                              byte[] header)
Detects the file content type from filename and/or file header.

Parameters:
filename - the name of the file
header - the first bytes of the file content
Returns:
the file content type detected, or null if detection was not possible