1 21 22 27 28 package javax.activation; 29 30 import java.io.File ; 31 32 47 48 public abstract class FileTypeMap { 49 50 private static FileTypeMap defaultMap = null; 51 52 55 public FileTypeMap() { 56 super(); 57 } 58 59 66 abstract public String getContentType(File file); 67 68 75 abstract public String getContentType(String filename); 76 77 85 public static void setDefaultFileTypeMap(FileTypeMap map) { 86 SecurityManager security = System.getSecurityManager(); 87 if (security != null) { 88 try { 89 security.checkSetFactory(); 91 } catch (SecurityException ex) { 92 if (FileTypeMap .class.getClassLoader() != 96 map.getClass().getClassLoader()) 97 throw ex; 98 } 99 } 100 defaultMap = map; 101 } 102 103 112 public static FileTypeMap getDefaultFileTypeMap() { 113 if (defaultMap == null) 115 defaultMap = new MimetypesFileTypeMap (); 116 return defaultMap; 117 } 118 } 119 | Popular Tags |