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


Java Ini.entrySet方法代码示例

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


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

示例1: parseRemotes

import org.ini4j.Ini; //导入方法依赖的package包/类
@NotNull
private static Pair<Collection<Remote>, Collection<Url>> parseRemotes(@NotNull Ini ini, @NotNull ClassLoader classLoader) {
  Collection<Remote> remotes = new ArrayList<Remote>();
  Collection<Url> urls = new ArrayList<Url>();
  for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
    String sectionName = stringSectionEntry.getKey();
    Profile.Section section = stringSectionEntry.getValue();

    Remote remote = parseRemoteSection(sectionName, section, classLoader);
    if (remote != null) {
      remotes.add(remote);
    }
    else {
      Url url = parseUrlSection(sectionName, section, classLoader);
      if (url != null) {
        urls.add(url);
      }
    }
  }
  return Pair.create(remotes, urls);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitConfig.java

示例2: WifImporter

import org.ini4j.Ini; //导入方法依赖的package包/类
public WifImporter(BitmessageContext ctx, InputStream in, Pubkey.Feature... features) throws IOException {
    this.ctx = ctx;

    Ini ini = new Ini();
    ini.load(in);

    for (Entry<String, Profile.Section> entry : ini.entrySet()) {
        if (!entry.getKey().startsWith("BM-"))
            continue;

        Profile.Section section = entry.getValue();
        BitmessageAddress address = Factory.createIdentityFromPrivateKey(
            entry.getKey(),
            getSecret(section.get("privsigningkey")),
            getSecret(section.get("privencryptionkey")),
            Long.parseLong(section.get("noncetrialsperbyte")),
            Long.parseLong(section.get("payloadlengthextrabytes")),
            Pubkey.Feature.bitfield(features)
        );
        if (section.containsKey("chan")) {
            address.setChan(Boolean.parseBoolean(section.get("chan")));
        }
        address.setAlias(section.get("label"));
        identities.add(address);
    }
}
 
开发者ID:Dissem,项目名称:Jabit,代码行数:27,代码来源:WifImporter.java

示例3: parseRemotes

import org.ini4j.Ini; //导入方法依赖的package包/类
@NotNull
private static Pair<Collection<Remote>, Collection<Url>> parseRemotes(@NotNull Ini ini, @Nullable ClassLoader classLoader) {
  Collection<Remote> remotes = new ArrayList<Remote>();
  Collection<Url> urls = new ArrayList<Url>();
  for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
    String sectionName = stringSectionEntry.getKey();
    Profile.Section section = stringSectionEntry.getValue();

    if (sectionName.startsWith("remote") || sectionName.startsWith("svn-remote")) {
      Remote remote = parseRemoteSection(sectionName, section, classLoader);
      if (remote != null) {
        remotes.add(remote);
      }
    }
    else if (sectionName.startsWith("url")) {
      Url url = parseUrlSection(sectionName, section, classLoader);
      if (url != null) {
        urls.add(url);
      }
    }
  }
  return Pair.create(remotes, urls);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GitConfig.java

示例4: validate

import org.ini4j.Ini; //导入方法依赖的package包/类
@Override public void validate(ConfigSchema schema, Ini config) throws ValidationException {
	Map<String, ConstraintValidator> validators = collectValidators();
	for (Map.Entry<String, Profile.Section> entry : config.entrySet()) {
		String groupName = entry.getKey();
		Profile.Section section = entry.getValue();
		for (String name : section.keySet()) {
			SchemaItem item = schema.get(groupName, name);
			if (item == null) {
				// should not happen
				LOGGER.warn("Found configuration item [" + groupName + "] " + name + " without corresponding schema item");
				continue;
			}
			validateItemValues(validators, item, section.getAll(name));
		}
	}
}
 
开发者ID:Skrethel,项目名称:simple-config-retrofit,代码行数:17,代码来源:DefaultSchemaConstraintValidator.java

示例5: parseConfig

import org.ini4j.Ini; //导入方法依赖的package包/类
@NotNull
private Map<String, String> parseConfig(@NotNull String content) throws IOException {
  @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
  final Ini ini = new Ini(new StringReader(content));
  final Map<String, String> result = new HashMap<>();
  for (Map.Entry<String, Profile.Section> sectionEntry : ini.entrySet()) {
    for (Map.Entry<String, String> configEntry : sectionEntry.getValue().entrySet()) {
      String value = configEntry.getValue();
      if (value.startsWith("\"") && value.endsWith("\"")) {
        value = value.substring(1, value.length() - 1);
      }
      result.put(sectionEntry.getKey() + ":" + configEntry.getKey(), value);
    }
  }
  return result;
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:17,代码来源:GitTortoise.java

示例6: parseTrackedInfos

import org.ini4j.Ini; //导入方法依赖的package包/类
@NotNull
private static Collection<BranchConfig> parseTrackedInfos(@NotNull Ini ini, @NotNull ClassLoader classLoader) {
  Collection<BranchConfig> configs = new ArrayList<BranchConfig>();
  for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
    String sectionName = stringSectionEntry.getKey();
    Profile.Section section = stringSectionEntry.getValue();
    if (sectionName.startsWith("branch")) {
      BranchConfig branchConfig = parseBranchSection(sectionName, section,  classLoader);
      if (branchConfig != null) {
        configs.add(branchConfig);
      }
    }
  }
  return configs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GitConfig.java

示例7: load

import org.ini4j.Ini; //导入方法依赖的package包/类
@SuppressFBWarnings({"NP_NULL_ON_SOME_PATH"})
@NotNull
public static GtConfig load(@NotNull File configFile) {
  if (!configFile.exists()) {
    LOG.info("No .git/config file at " + configFile.getPath());
    return EMPTY;
  } else {
    Ini ini = new Ini();
    ini.getConfig().setMultiOption(true);
    ini.getConfig().setTree(false);

    try {
      ini.load(configFile);
    } catch (IOException exception) {
      LOG.warn(new RepoStateException("Couldn\'t load .git/config file at " + configFile.getPath(), exception));
      return EMPTY;
    }
    ImmutableSet.Builder<String> svnRemotes = ImmutableSet.builder();
    for (Entry<String, Section> section : ini.entrySet()) {
      Matcher matcher = SVN_REMOTE_SECTION.matcher(section.getKey());
      if (matcher.matches()) {
        String name = matcher.group(1);
        svnRemotes.add(name);
      }
    }
    return new GtConfig(svnRemotes);
  }
}
 
开发者ID:zielu,项目名称:GitToolBox,代码行数:29,代码来源:GtConfig.java

示例8: parseTrackedInfos

import org.ini4j.Ini; //导入方法依赖的package包/类
@NotNull
private static Collection<BranchConfig> parseTrackedInfos(@NotNull Ini ini, @Nullable ClassLoader classLoader) {
  Collection<BranchConfig> configs = new ArrayList<BranchConfig>();
  for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
    String sectionName = stringSectionEntry.getKey();
    Profile.Section section = stringSectionEntry.getValue();
    if (sectionName.startsWith("branch")) {
      BranchConfig branchConfig = parseBranchSection(sectionName, section,  classLoader);
      if (branchConfig != null) {
        configs.add(branchConfig);
      }
    }
  }
  return configs;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:GitConfig.java

示例9: parseSettings

import org.ini4j.Ini; //导入方法依赖的package包/类
/*************************************************************************
 * Parse the settings file and extract all network.proxy.* settings from it.
 * 
 * @param source
 *            of the Firefox profiles.
 * @return the parsed properties.
 * @throws IOException
 *             on read error.
 ************************************************************************/

public Properties parseSettings(FirefoxProfileSource source) throws IOException {
	// Search settings folder
	File profileFolder = null;

	// Read profiles.ini
	File profilesIniFile = source.getProfilesIni();
	if (profilesIniFile.exists()) {
		Ini profilesIni = new Ini(profilesIniFile);
		for (Entry<String, Section> entry : profilesIni.entrySet()) {
			if ("default".equals(entry.getValue().get("Name"))) {
				if ("1".equals(entry.getValue().get("IsRelative"))) {
					profileFolder = new File(profilesIniFile.getParentFile().getAbsolutePath(),
					        entry.getValue().get("Path"));
				}
			}
		}
	}
	if (profileFolder != null) {
		Logger.log(getClass(), LogLevel.DEBUG, "Firefox settings folder is {0}", profileFolder);
	} else {
		Logger.log(getClass(), LogLevel.DEBUG, "Firefox settings folder not found!");
	}

	// Read settings from file
	File settingsFile = new File(profileFolder, "prefs.js");

	BufferedReader fin = new BufferedReader(new InputStreamReader(new FileInputStream(settingsFile)));

	Properties result = new Properties();
	try {
		String line = fin.readLine();
		while (line != null) {
			line = line.trim();
			if (line.startsWith("user_pref(\"network.proxy")) {
				line = line.substring(10, line.length() - 2);
				int index = line.indexOf(",");
				String key = line.substring(0, index).trim();
				if (key.startsWith("\"")) {
					key = key.substring(1);
				}
				if (key.endsWith("\"")) {
					key = key.substring(0, key.length() - 1);
				}
				String value = line.substring(index + 1).trim();
				if (value.startsWith("\"")) {
					value = value.substring(1);
				}
				if (value.endsWith("\"")) {
					value = value.substring(0, value.length() - 1);
				}
				result.put(key, value);
			}
			line = fin.readLine();
		}
	} finally {
		fin.close();
	}

	return result;
}
 
开发者ID:MarkusBernhardt,项目名称:proxy-vole,代码行数:71,代码来源:FirefoxSettingParser.java


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