阅读569 返回首页    go 阿里云 go 技术社区[云栖]


Properties读取文件缓存数据

private static Properties cache = new Properties();
	static{
		try {
			cache.load(ConfigInfo.class.getClassLoader().getResourceAsStream("xxx.key"));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	 * 获取指定key的值
	 * @param key
	 * @return
	 */
	public static String getValue(String key){
		return cache.getProperty(key);
	}



使用Properties函数,可以以key -value键值方式取出文件中的值。

最后更新:2017-04-02 16:47:52

  上一篇:go android信息-摘要校验信息
  下一篇:go J2EE中在web.xml异常页面跳转