Java Properties读写文件

InputStream is=new FileInputStream(path)
Properties p=new Properties();
p.load(is);

把磁盘中的文件数据库加载到内存中
String value = p.getProperty(key); //获取值

让后设置值
p.setProperty(key,value); //设置值

修改后数据依然还在内存。要想保存到文件必须把它从内存中存储到磁盘文件
OutputStream os=new FileOutputStream(path, null)
p.store(os);
posted @ 2014-07-17 09:06  fenglie  阅读(193)  评论(0)    收藏  举报
版权所有,转载声明