本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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));
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}