问题
i have .ini file with following structure:
[HEADING1][SUBHEADING]
DBUSer=John
DBPASSWD=Joe1234
i am not able to read values from the subgroup(SUBHEADING) of group (HEADING1).I tried hard to search not net but not find any hint, please share your view on that.
i am able to read .ini file with this structure:
[HEADING1]
DBUSer=John
DBPASSWD=Joe1234
but for subgroup i am facing problem.
Ini ini = new Ini(new File("/path/to/file"));
System.out.println(ini.get("HEADING1", "DBUSer"));
or if you have any other solution or library please share it here.
回答1:
I haven't tried this, but according to the documentation this should be possible by using the TreeModel:
Ini ini = new Ini(new File("/path/to/file"));
System.out.println(ini.get("HEADING1/SUBHEADING", "DBUSer"));
You can find a sample here ( method sample05()
).
来源:https://stackoverflow.com/questions/19490450/how-to-read-sub-group-values-from-ini-file-in-java