您的位置:首页 > 运维架构

[zz] Read and write a properties file

2010-09-03 16:08 435 查看
// Read properties file.
Properties properties = new Properties();
try {
properties.load(new FileInputStream("filename.properties"));
}
catch (IOException e) {
}
// Write properties file.
try {
properties.store(new FileOutputStream("filename.properties"), null);
}
catch (IOException e) {
}


Here is an example of the contents of a properties file:

# a comment
! a comment
a = a string
b = a string with escape sequences /t /n /r // /" /' / (space) /u0123
c = a string with a continuation line /
continuation line
d.e.f = another string
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: