1 16 17 package org.xml.sax.helpers; 18 19 import java.io.File ; 20 import java.io.FileInputStream ; 21 import java.io.FileNotFoundException ; 22 import java.io.InputStream ; 23 24 31 class SecuritySupport { 32 33 38 private static final Object securitySupport; 39 40 static { 41 SecuritySupport ss = null; 42 try { 43 Class c = Class.forName("java.security.AccessController"); 44 54 ss = new SecuritySupport12 (); 55 } catch (Exception ex) { 56 } finally { 58 if (ss == null) 59 ss = new SecuritySupport (); 60 securitySupport = ss; 61 } 62 } 63 64 68 public static SecuritySupport getInstance() { 69 return (SecuritySupport )securitySupport; 70 } 71 72 public ClassLoader getContextClassLoader() { 73 return null; 74 } 75 76 public String getSystemProperty(String propName) { 77 return System.getProperty(propName); 78 } 79 80 public FileInputStream getFileInputStream(File file) 81 throws FileNotFoundException 82 { 83 return new FileInputStream (file); 84 } 85 86 public InputStream getResourceAsStream(ClassLoader cl, String name) { 87 InputStream ris; 88 if (cl == null) { 89 ris = ClassLoader.getSystemResourceAsStream(name); 90 } else { 91 ris = cl.getResourceAsStream(name); 92 } 93 return ris; 94 } 95 } 96 | Popular Tags |