package org.texttechnologylab.project.gruppe_05_1.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public abstract class PropertiesUtils {

    public static Properties readPropertiesFromResource(String propertiesFileName) {

        Properties properties = new Properties();
        try (InputStream input =  PropertiesUtils.class.getClassLoader().getResourceAsStream(propertiesFileName)) {
            if (null == input) {
                Logger.warn("Failed to read properties file '" + propertiesFileName);
            }

            properties.load(input);
        } catch (IOException ioex) {
            Logger.warn("Exception occured while reading properties file '" + propertiesFileName + "': " + ioex.getLocalizedMessage());
        }

        return properties;
    }
}
