首页 > 编程语言 > 详细

java 写 Properties文件

时间:2014-04-10 03:41:30      阅读:257      评论:0      收藏:0      [点我收藏+]



bubuko.com,布布扣网上看到许多对于Properties的读取查找,找了半天没有看到写的。肯能是太简单了,于是我查阅文档尝试了一下写的操作,记一下,才几行。

public class Read {
	private static String path = "config.properties";
	private static String other = "other.properties";
	
	
	public static void main(String[] args) throws IOException {
		//读
		InputStream in = new BufferedInputStream(new FileInputStream(path));
		Properties prop = new Properties();
		prop.load(in);
		System.out.println(prop.getProperty("one"));
		
		//写
		OutputStream out = new FileOutputStream(new File(other));
		prop.store(out, "");
		out.close();
		in.close();
	}

}

读写都在这里了



java 写 Properties文件,布布扣,bubuko.com

java 写 Properties文件

原文:http://blog.csdn.net/suifengerbi/article/details/23283967

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!