Java Code Examples for org.ini4j.Ini#entrySet()
The following examples show how to use
org.ini4j.Ini#entrySet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WifImporter.java From Jabit with Apache License 2.0 | 6 votes |
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); } }
Example 2
Source File: GtConfig.java From GitToolBox with Apache License 2.0 | 5 votes |
@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); } }
Example 3
Source File: GitTortoise.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
@NotNull static GitTortoise parseConfig(@NotNull InputStream stream) throws IOException { @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") final Ini ini = new Ini(stream); 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 new GitTortoise(result.isEmpty() ? Collections.emptyMap() : result); }