我正在尝试修改此 ini 文件的 dbVersion 属性的值
[Settings]
Access=ReadWrite
Type=1
AutomationDbString=jdbc:mysql:ser=php&password=php
automationServerTestResultPath=/testresult/
automationServerTestResultPathWrite=testresult
automationServerTestResultPathRead=http:testresult
automationServerBuildPath=\testresult\\builds
automationServerReferenceFilesPath=\\reference_files
automationToolBaseUrl=http:/dpa
agentInstallBuildFolder = c:\\dev\\builds
agentAntLogFolder = c:\\dev\\logs
exportToTaf=true
dbEnable=true
dbVersion=606A8
dbName=archauto606
archticsLocation=//source/QA
userName=Administator
pwdName=hombre007!
archticsPatchLocation=patch\
[Root]
执行这部分代码后,我的文件结构发生了变化
Properties p = new Properties();
p.load(new FileInputStream("C:\\agent\\Testcomplete2.ini"));
System.out.println("dbVersion = " + p.getProperty("dbVersion"));
p.setProperty("dbVersion", "606A21");
p.store(new FileOutputStream("C:\\agent\\Testcomplete2.ini"), null);
#Mon Jul 22 13:49:54 EDT 2013
[Root]=
agentInstallBuildFolder=c\:\\dev\\builds
AutomationDbString=jdbc\:mysql\:ser\=php&password\=php
automationServerBuildPath=\testresult\\builds
automationServerTestResultPathWrite=testresult
dbVersion=606A21
pwdName=hombre007\!
exportToTaf=true
Type=1
userName=Administator
automationServerTestResultPathRead=http\:testresult
dbEnable=true
archticsPatchLocation=patch
[Settings]=
automationServerReferenceFilesPath=\\reference_files
Access=ReadWrite
automationToolBaseUrl=http\:/dpa
archticsLocation=//source/QA
automationServerTestResultPath=/testresult/
dbName=archauto606
agentAntLogFolder=c\:\\dev\\logs
但是在执行 p.store 行之后,我注意到我的文件结构发生了变化,我无法解析该文件。只是询问是否有办法只修改值而不改变文件的结构。
感谢您的帮助。