您的位置:首页 > 其它

ResourceBundle 的一种使用方法

2017-12-13 09:09 141 查看
使用ResourceBundle 来获取配置文件过程:

public void test() throws IOException{

String proFilePath = "src/res.properties";
BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(proFilePath));
ResourceBundle rb = new PropertyResourceBundle(inputStream);
String ssString = rb.getString("cancelKey");
System.out.println(ssString);
}


其中配置文件res.properpites中内容为:

cancelKey=cancel

执行代码:

得到输出:cancel

完成!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ResourceBu