use of org.ini4j.Config in project buck by facebook.
the class Inis method read.
public static ImmutableMap<String, ImmutableMap<String, String>> read(Reader reader) throws IOException {
Ini ini = new Ini();
Config config = ini.getConfig();
config.setEscape(false);
config.setEscapeNewline(true);
ini.load(reader);
validateIni(ini);
ImmutableMap.Builder<String, ImmutableMap<String, String>> sectionsToEntries = ImmutableMap.builder();
for (String sectionName : ini.keySet()) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
Profile.Section section = ini.get(sectionName);
for (String propertyName : section.keySet()) {
String propertyValue = section.get(propertyName);
builder.put(propertyName, propertyValue);
}
ImmutableMap<String, String> sectionToEntries = builder.build();
sectionsToEntries.put(sectionName, sectionToEntries);
}
return sectionsToEntries.build();
}
Aggregations