
uk.co.mruoc.properties.DefaultPropertyLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of file-loader Show documentation
Show all versions of file-loader Show documentation
Code library to easily load files and file from the classpath or file system file
package uk.co.mruoc.properties;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.util.Properties;
public class DefaultPropertyLoader implements PropertyLoader {
private final InputStreamConverter converter = new InputStreamConverter();
private final InputStreamLoader inputStreamLoader;
public DefaultPropertyLoader(InputStreamLoader inputStreamLoader) {
this.inputStreamLoader = inputStreamLoader;
}
@Override
public Properties load(String path) {
try (InputStream stream = inputStreamLoader.load(path)) {
return converter.toProperties(stream);
} catch (IOException | UncheckedIOException e) {
throw new PropertiesNotFoundException(path, e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy