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

com.github.bingoohuang.utils.config.impl.PropertiesConfigable Maven / Gradle / Ivy

There is a newer version: 0.0.25
Show newest version
package com.github.bingoohuang.utils.config.impl;

import com.google.common.io.Closeables;
import org.springframework.core.io.Resource;

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

public class PropertiesConfigable extends DefaultConfigable {

    public PropertiesConfigable(Resource res) {
        super(buildProperties(res));
    }

    private static Properties buildProperties(Resource res) {
        Properties properties = new Properties();
        InputStream inputStream = null;;
        try {
            inputStream = res.getInputStream();
            properties.load(inputStream);
        }
        catch (IOException e) {
            Closeables.closeQuietly(inputStream);
        }

        return properties;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy