Java读取配置文件工具类PropFileConfig
来源:互联网 发布:淘宝商品怎么发链接 编辑:程序博客网 时间:2024/05/16 18:20
public class PropFileConfig {
private static final String SYS_CONFIG_FILE_NAME = “config.properties”;
private static PropertiesConfiguration config;
static { try { config = new PropertiesConfiguration(SYS_CONFIG_FILE_NAME); } catch (ConfigurationException e) { e.printStackTrace(); }}public static String getProperty(String key) { String value = config.getString(key); return (value == null) ? "" : value;}public static String getPropertys(String key) { String[] value = config.getStringArray(key); return (value == null) ? "" : Arrays.toString(value).replace("[", "").replace("]", "");}public static String[] getPropertyArray(String key) { String[] value = config.getStringArray(key); return (value == null) ? new String[]{} : value;}public static void removeProperty(String key) { config.clearProperty(key);}public static void setProperty(String key, String value) { config.setProperty(key, value);}public static void saveChange() { try { config.save(); } catch (ConfigurationException e) { e.printStackTrace(); }}
}
0 0
- Java读取配置文件工具类PropFileConfig
- java读取配置文件工具类
- Java工具类之配置文件读取
- java工具类之配置文件的读取
- 【Java工具类】----读取.prop配置文件
- 读取配置文件工具类
- 配置文件读取工具类
- 读取配置文件工具类
- 配置文件读取工具类
- 配置文件读取工具类
- java 数据库读取工具类(读取config.properties配置文件)
- java 数据库读取工具类(读取config.properties配置文件)
- property配置文件读取工具类
- 读取配置文件的工具类
- 读取.properties配置文件工具类!!!
- 读取Properties配置文件工具类
- 读取配置文件properties工具类
- properties配置文件读取工具类
- memcached工作原理与优化建议
- Android第二十六课;ViewPager
- Flyway 数据库版本管理控制
- sfm
- CommonJS和AMD/CMD!
- Java读取配置文件工具类PropFileConfig
- tomcat源码分析三:tomcat启动与停止
- [Leetcode] Add Two Numbers Python实现 详细讲解
- C++类(Class)的定义与实现
- UVA673:Parentheses Balance(平衡的括号)
- Android Studio 导入官方示例下载出错解决方法
- 第十九套
- python计算时间差
- 数据结构 和 算法 的概念