I have an existing method that gets properties from a fixed location. This method also allows me to specify an override to use a different properties file. I want to be able to specify a file that is on the classpath while preserving the current functionality. How would I modify this to achieve this functionality?
protected Properties getProperties(String pathToPropertiesFile) throws IOException {
if (pathToPropertiesFile == null) {
pathToPropertiesFile = "/etc/machineProperties.properties";
}
FileInputStream inputStream = new FileInputStream(pathToPropertiesFile);
Properties props = new Properties();
props.load(inputStream);
return props;
}
All the IO utilities I have found so far work for only files on the classpath or files with absolute paths.