package com.foc.util;

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

/**
 * @author 臧涛
 */
public class PropertiesUtil {

    private PropertiesUtil() {}

    private static Properties properties = null;

    public static Properties getProperties(String path) {

        if (properties == null) {
            try {
                Properties prop = new Properties();
                InputStream in = new FileInputStream(path);
//                InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream("global.properties");
                prop.load(in);
                properties = prop;
                return properties;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return properties;
    }

    public static Properties getProperties() {
        return properties;
    }

}
