JAVA:配置文件读取器
岁数大了,QQ也不闪了,微信也不响了,电话也不来了,但是图老师依旧坚持为大家推荐最精彩的内容,下面为大家精心准备的JAVA:配置文件读取器,希望大家看完后能赶快学习起来。
〔config.properties〕
[CMS properties]
cmsServerName=cms
cmsTemplateDirectoryName=template
[time out:minute]
time_out=300000
[administrator setting]
administrator=SA
admingroup=ADMINROLE
[web path setting]
innerresource=/AccessControl/jsp/innerresource/
[picture path setting]
picturePath=C:/picture/
[log path setting]
logPath=c:/log1/
ConfigBundle.Java
package creator.config;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
*
* pTitle: ConfigBundle.java/p
* pDescription: /p
* pCopyright: Copyright (c) 2004/p
* pCompany: /p
* @author TanBo
* @version 1.0
*/
public class ConfigBundle{
private static ResourceBundle bundle;
/**
* init()
*/
public ConfigBundle()
{
}
/**
* @function getString
* @param s String
* @return String
*/
public static String getString(String s){
String s1 = null;
try{
s1 = getResourceBundle().getString(s);
}catch(MissingResourceException missingresourceexception){
System.out.println("ConfigBundle:getString error!"+missingresourceexception.toString());
}
return s1;
}
/**
* @function getResourceBundle
* @return ResourceBundle
*/
private static ResourceBundle getResourceBundle(){
if(bundle == null)
bundle = ResourceBundle.getBundle("creator.config.config");
return bundle;
}
}