单例模式读取Properties文件
来源:互联网 发布:简易电路设计软件 编辑:程序博客网 时间:2024/05/17 02:55
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* 读取Properties属性文件
* @author LYF
*/
public class Env extends Properties {
private static Env instance;
public static Env getInstance(String path){
if (instance != null){
return instance;
}else {
makeInstance(path);
return instance;
}
}
private static synchronized void makeInstance(String path){
if (instance == null){
instance = new Env(path);
}
}
private Env(String path){
InputStream is = getClass().getResourceAsStream(path);
try {
load(is);
} catch (IOException ex) {
System.err.println("错误信息: 读取属性文件失败!");
System.err.println("请确认 【"+ path +"】 文件是否存在。");
}
}
}
- 使用单例模式读取Properties文件
- 单例模式读取Properties文件
- 读取Properties文件(单例模式)
- 单例模式读取Properties文件
- 使用单例模式读取properties文件
- JAVA读取properties文件代码 单例模式
- JAVA单例模式读取properties配置文件
- 使用单例模式加载properties文件
- 使用单例模式加载properties文件
- 单例模式 [ Properties ]
- Java 单例模式获取Properties文件内容
- 【设计模式:单例模式】使用单例模式加载properties文件
- 【设计模式:单例模式】使用单例模式加载properties文件
- Properties读取properties文件
- Properties 读取 Properties文件
- 单例模式加载properties配置文件
- 单例模式解析properties 配置文件
- Properties文件读取 Message.properties
- 股票技术指标
- 关于HTTP客户端重复发送请求的问题
- linux C 编程 一站式学习(一)
- List集合知识总结
- 常用log4j配置
- 单例模式读取Properties文件
- Java中的流、字符流和字节流
- Could not open: \.android/avd/2.2.ini
- vc++6.0编译器按照内存地址递减的方式来给变量分配内存
- 用java计算:1-1/3+1/5-1/7+1/9-1/11+......的前10000项之和
- 第一次C程序设计上机报告
- eclipse maven插件在线安装
- Android 第三方ROM CyanogenMod 源码下载,编译,刷机
- lua 中文教程 notes.