当前位置: 首页>>代码示例>>Java>>正文


Java Ini.keySet方法代码示例

本文整理汇总了Java中org.ini4j.Ini.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java Ini.keySet方法的具体用法?Java Ini.keySet怎么用?Java Ini.keySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ini4j.Ini的用法示例。


在下文中一共展示了Ini.keySet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSubsetOf

import org.ini4j.Ini; //导入方法依赖的package包/类
private void isSubsetOf(String sourceIniPath, String expectedIniPath) throws IOException {
    Ini goldenIni = new Ini(new FileInputStream(expectedIniPath));
    Ini sourceIni = new Ini(new FileInputStream(sourceIniPath));
    for(String key : goldenIni.keySet()) {
        if(!sourceIni.containsKey(key) && goldenIni.get(key).size() > 0) {
            fail("missing section " + key + " in file " + sourceIniPath);
        }

        Section goldenSection = goldenIni.get(key);
        Section sourceSection = sourceIni.get(key);

        for(String name : goldenSection.childrenNames()) {
            if(!sourceSection.containsKey(name)) {
                fail("missing name " + name + " in file " + sourceIniPath + " section [" + name + "]");
            }                
            assertEquals(goldenSection.get(name), sourceSection.get(name));
        }                
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SvnConfigFilesTest.java

示例2: sample01

import org.ini4j.Ini; //导入方法依赖的package包/类
void sample01(Ini ini)
    {
        Ini.Section section = ini.get("happy");

        //
        // read some values
        //
        String age = section.get("age");
        String weight = section.get("weight");
        String homeDir = section.get("homeDir");

        //
        // .. or just use java.util.Map interface...
        //
        Map<String, String> map = ini.get("happy");

        age = map.get("age");
        weight = map.get("weight");
        homeDir = map.get("homeDir");

        // get all section names
        Set<String> sectionNames = ini.keySet();

//}
        Helper.assertEquals(DwarfsData.happy, section.as(Dwarf.class));
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:27,代码来源:IniTutorial.java

示例3: getTransifexConfig

import org.ini4j.Ini; //导入方法依赖的package包/类
public static TransifexConfig getTransifexConfig(String path) throws IOException {

        Map<String, String> languageMap = new HashMap<>();
        Map<String, TransifexResource> resourceMap = new HashMap<>();

        Path localResourcesPath = Settings.getLocalResourcesPath();
        
        Reader reader = localResourcesPath != null ? Files.newBufferedReader(localResourcesPath.resolve(path), StandardCharsets.UTF_8) : new InputStreamReader(Settings.class.getResourceAsStream(Settings.CONFIG_PATH + path), StandardCharsets.UTF_8);
        
        Ini ini = new Ini(reader);

        for (String sectionName : ini.keySet()) {
            if (sectionName.equals("main")) {
                languageMap.putAll(getLanguageMap(ini.get(sectionName).get("lang_map")));
            } else {
                resourceMap.putAll(getResourceMap(sectionName, ini.get(sectionName)));
            }
        }

        return new TransifexConfig(languageMap, resourceMap);
    }
 
开发者ID:drifted-in,项目名称:txgh,代码行数:22,代码来源:TransifexConfigUtil.java

示例4: createFromReaders

import org.ini4j.Ini; //导入方法依赖的package包/类
@VisibleForTesting
static Map<String, Map<String, String>> createFromReaders(Iterable<Reader> readers)
    throws IOException {
  Preconditions.checkNotNull(readers);

  Ini ini = new Ini();
  for (Reader reader : readers) {
    // The data contained by reader need to be processed twice (first during validation, then
    // when merging into ini), so read the data into a string that can be used as the source of
    // two StringReaders.
    try (Reader r = reader) {
      String iniString = CharStreams.toString(r);
      validateReader(new StringReader(iniString));
      ini.load(new StringReader(iniString));
    }
  }

  Map<String, Map<String, String>> sectionsToEntries = Maps.newHashMap();
  for (String sectionName : ini.keySet()) {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    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;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:33,代码来源:BuckConfig.java

示例5: validateReader

import org.ini4j.Ini; //导入方法依赖的package包/类
private static void validateReader(Reader reader) throws IOException {
  // Verify that within each ini file, no section has the same key specified more than once.
  Ini ini = new Ini();
  ini.load(reader);
  for (String sectionName : ini.keySet()) {
    Section section = ini.get(sectionName);
    for (String propertyName : section.keySet()) {
      if (section.getAll(propertyName).size() > 1) {
        throw new HumanReadableException("Duplicate definition for %s in [%s].",
            propertyName,
            sectionName);
      }
    }
  }
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:16,代码来源:BuckConfig.java

示例6: validateIni

import org.ini4j.Ini; //导入方法依赖的package包/类
private static void validateIni(Ini ini) {
  // Verify that no section has the same key specified more than once.
  for (String sectionName : ini.keySet()) {
    Profile.Section section = ini.get(sectionName);
    for (String propertyName : section.keySet()) {
      if (section.getAll(propertyName).size() > 1) {
        throw new HumanReadableException(
            "Duplicate definition for %s in the [%s] section of your .buckconfig or "
                + ".buckconfig.local.",
            propertyName, sectionName);
      }
    }
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:15,代码来源:Inis.java

示例7: getNames

import org.ini4j.Ini; //导入方法依赖的package包/类
/**
 * @return list of data source names
 */
public ImmutableList<String> getNames() {
	ImmutableList.Builder<String> builder = new ImmutableList.Builder<String>();
	for (Ini ini : inis)
		for (String name : ini.keySet())
			if (ini.get(name).get("type") != null)
				builder.add(name);
	return builder.build();
}
 
开发者ID:charite,项目名称:jannovar,代码行数:12,代码来源:DataSourceFactory.java


注:本文中的org.ini4j.Ini.keySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。