All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.mruoc.properties.DefaultPropertyLoader Maven / Gradle / Ivy

Go to download

Code library to easily load files and file from the classpath or file system file

There is a newer version: 7.0.4
Show newest version
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