01: package org.enhydra.dm.util;
02:
03: import java.util.Properties;
04:
05: /**
06: * Mime type mapper class. Use editablemimetypes.properties with editable mime types list
07: *
08: * @author Svjetlana Milidrag
09: */
10:
11: public class MimeUtility {
12: /**
13: * Methos for extracting mime type for corresponding file extension
14: *
15: * @param editableMT
16: * @param documentName
17: * @return
18: */
19: public static String mimeTypeMapper(Properties editableMT,
20: String documentName) {
21:
22: String extension = documentName.substring(documentName
23: .lastIndexOf("."));
24:
25: return editableMT.getProperty(extension);
26:
27: }
28:
29: /**
30: * Method that search for mime type in editablemimetypes.properties file.
31: *
32: * @param editableMT
33: * @param mimetype
34: * @return true if file is editable, false otherwise
35: */
36: public static boolean isEditableDocument(Properties editableMT,
37: String mimetype) {
38:
39: return editableMT.containsValue(mimetype);
40: }
41:
42: }
|