| searches the given resource, first on the root of the classpath and if not
not found there, in the given directory.
public static InputStream getStream(String resource, String directory) {
InputStream is = getClassLoader().getResourceAsStream(resource);
if (is==null) {
is = getClassLoader().getResourceAsStream(directory+"/"+resource);
}
return is;
}
public static Properties getProperties(String resource, String directory) {
Properties properties = new Properties();
try {
properties.load(getStream(resource, directory));
} catch (IOException e) {
throw new JbpmException("couldn't load properties file '"+resource+"'", e);
}
return properties;
}
|