`
yng02yng
  • 浏览: 9218 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

资源文件读取笔记-潇湘客-iteye技术网站

阅读更多

资源文件读取笔记-潇湘客-iteye技术网站
2011年07月01日
  今天用到了资源文件读取 ,今天先记下来,以后用到了再添加进来. 
  资源文件 bin目录下的sql.config package com.tang.test; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class TestResourceParse { private Properties properties; private String resourcePath="mysql.config"; public void prepareParse(String resourcePath) { InputStream dataStream=this.getClass().getClassLoader().getRes ourceAsStream(resourcePath); properties=new Properties(); try { properties.load(dataStream); } catch (IOException e) { e.printStackTrace(); } } public void getValue(){ String driver=properties.getProperty("driver"); String url=properties.getProperty("url"); String username=properties.getProperty("username"); } } 
  
  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics