1 6 7 12 13 package com.hp.hpl.jena.regression; 14 15 import java.io.InputStream ; 16 import java.io.FileInputStream ; 17 import java.io.IOException ; 18 28 class ResourceReader { 29 static boolean useClassLoader = false; 31 36 private ResourceReader() {} 37 42 43 static InputStream getInputStream(String prop) throws IOException { 44 if ( useClassLoader) { 45 ClassLoader loader = ResourceReader.class.getClassLoader(); 46 if ( loader == null ) 47 throw new SecurityException ("Cannot access class loader"); 48 InputStream in = loader.getResourceAsStream(prop); 49 if ( in == null ) 50 throw new IllegalArgumentException ("Resource: " + prop + " not found on class path."); 51 return in; 52 } else { 53 return new FileInputStream (prop); 54 } 55 } 56 57 } 58 59 88 | Popular Tags |