Java Properties类 按输入顺序输出,每条添加注释
今天想把输入Property类的信息,输出看一下,输出之后发现顺序是乱的,后来看了代码才明白怎么回事,于是决定自己瞎写一个,经测试还能用。望各位大神观摩指导。。。。
主要是实现两个功能:
1.顺序输出:
用户通过使用方法setP来插入数据,三个参数分别为key,value,和comment。之后通过orderStore来输出内容。
2.为每条属性添加注释
通过setP方法添加的属性都会有注释参数。如果只想使用注释这个功能,可以通过java的Properties类来构造此类对象,之后通过addComment方法来为想要添加的属性添加注释
测试程序:
#This is a test process...#Wed Mar 13 15:34:03 CST 2013#the name of 0Name0=0#the name of 1Name1=1#the name of 2Name2=2#the name of 3Name3=3#the name of 4Name4=4#the name of 5Name5=5#the name of 6Name6=6#the name of 7Name7=7#the name of 8Name8=8#the name of 9Name9=9