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


Java Ini.load方法代码示例

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


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

示例1: getPicUrl

import org.ini4j.Ini; //导入方法依赖的package包/类
private String getPicUrl(String filename)
{
	String url = null;
	Ini ini = new Ini();
	String filepath = configData.coolqDir + "/data/image/" + filename + ".cqimg";
	try
	{
		ini.load(new FileReader(filepath));
	} catch (IOException e)
	{
		e.printStackTrace();
	}
	Ini.Section section = ini.get("image");
	url = section.get("url");
	return url;
}
 
开发者ID:XiLingHost,项目名称:tg-qq-trans,代码行数:17,代码来源:GetQQPic.java

示例2: test

import org.ini4j.Ini; //导入方法依赖的package包/类
private void test(String filename, String defaultEncoding) throws Exception
{
    Charset charset = (defaultEncoding == null) ? Config.DEFAULT_FILE_ENCODING : Charset.forName(defaultEncoding);
    UnicodeInputStreamReader reader = new UnicodeInputStreamReader(getClass().getResourceAsStream(filename), charset);
    Ini ini = new Ini();

    ini.setConfig(Config.getGlobal().clone());
    ini.getConfig().setFileEncoding(charset);
    ini.load(reader);
    Ini.Section sec = ini.get("section");

    if (sec == null)
    {
        throw new IllegalStateException("Missing section: section");
    }

    if (!"value".equals(sec.get("option")))
    {
        throw new IllegalStateException("Missing option: option");
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:22,代码来源:UnicodeInputStreamReaderTest.java

示例3: 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

示例4: MyConfig

import org.ini4j.Ini; //导入方法依赖的package包/类
MyConfig() throws IOException {
    System.out.println("Parsing config.ini");

    org.ini4j.Config.getGlobal().setEscape(false);
    Ini ini = new Ini();
    ini.load(new FileReader("config.ini"));

    Ini.Section section = ini.get("paths");
    //TODO check if these are valid directories
    this._inputRoot = this.getIniValue(section, "input dir") + File.separator;
    this._outputRoot = this.getIniValue(section, "output dir") + File.separator;
    this._imPath = this.getIniValue(section, "imagemagick dir") + File.separator;

    section = ini.get("surface map");
    this.minZoomSurface = Integer.parseInt(this.getIniValue(section, "min zoom"));
    this.maxZoomSurface = Integer.parseInt(this.getIniValue(section, "max zoom"));
    this.defZoomSurface = Integer.parseInt(this.getIniValue(section, "default zoom"));
    
    section = ini.get("underground map");
    this.minZoomUnderground = Integer.parseInt(this.getIniValue(section, "min zoom"));
    this.maxZoomUnderground = Integer.parseInt(this.getIniValue(section, "max zoom"));
    this.defZoomUnderground = Integer.parseInt(this.getIniValue(section, "default zoom"));
    
    ini.clear();
}
 
开发者ID:diggu,项目名称:wu2gmap,代码行数:26,代码来源:MyConfig.java

示例5: read

import org.ini4j.Ini; //导入方法依赖的package包/类
/**
 * Creates an instance of GitConfig by reading information from the specified {@code .git/config} file.
 * @throws RepoStateException if {@code .git/config} couldn't be read or has invalid format.<br/>
 *         If in general it has valid format, but some sections are invalid, it skips invalid sections, but reports an error.
 */
@NotNull
static GitConfig read(@NotNull GitPlatformFacade platformFacade, @NotNull File configFile) {
  Ini ini = new Ini();
  ini.getConfig().setMultiOption(true);  // duplicate keys (e.g. url in [remote])
  ini.getConfig().setTree(false);        // don't need tree structure: it corrupts url in section name (e.g. [url "http://github.com/"]
  try {
    ini.load(configFile);
  }
  catch (IOException e) {
    LOG.error(new RepoStateException("Couldn't load .git/config file at " + configFile.getPath(), e));
    return new GitConfig(Collections.<Remote>emptyList(), Collections.<Url>emptyList(), Collections.<BranchConfig>emptyList());
  }

  IdeaPluginDescriptor plugin = platformFacade.getPluginByClassName(GitConfig.class.getName());
  ClassLoader classLoader = plugin == null ? null : plugin.getPluginClassLoader(); // null if IDEA is started from IDEA

  Pair<Collection<Remote>, Collection<Url>> remotesAndUrls = parseRemotes(ini, classLoader);
  Collection<BranchConfig> trackedInfos = parseTrackedInfos(ini, classLoader);
  
  return new GitConfig(remotesAndUrls.getFirst(), remotesAndUrls.getSecond(), trackedInfos);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:GitConfig.java

示例6: build

import org.ini4j.Ini; //导入方法依赖的package包/类
private static void build(String name)
		throws FileNotFoundException, IOException, SerializationException, TranscriptParseException {
	// create temporary directory
	File tmpDir = Files.createTempDir();
	// copy files
	ResourceUtils.copyResourceToFile("/ex_" + name + "/transcript.gff3", new File(tmpDir + "/transcript.gff3"));
	ResourceUtils.copyResourceToFile("/ex_" + name + "/hgnc_complete_set.txt", new File(tmpDir + "/hgnc_complete_set.txt"));
	ResourceUtils.copyResourceToFile("/ex_" + name + "/ref.fa", new File(tmpDir + "/ref.fa"));
	ResourceUtils.copyResourceToFile("/ex_" + name + "/rna.fa", new File(tmpDir + "/rna.fa"));
	ResourceUtils.copyResourceToFile("/ex_" + name + "/data.ini", new File(tmpDir + "/data.ini"));
	// build ReferenceDictionary
	ReferenceDictionaryBuilder refDictBuilder = new ReferenceDictionaryBuilder();
	refDictBuilder.putContigID("ref", 1);
	refDictBuilder.putContigLength(1, 500001);
	refDictBuilder.putContigName(1, "ref");
	ReferenceDictionary refDict = refDictBuilder.build();
	// parse TranscriptModel
	Ini ini = new Ini();
	ini.load(new File(tmpDir + "/data.ini"));
	RefSeqParser parser = new RefSeqParser(refDict, tmpDir.toString(), ini.get("dummy"));
	ImmutableList<TranscriptModel> tms = parser.run();
	JannovarData data = new JannovarData(refDict, tms);
	// write out file
	new JannovarDataSerializer("mini_" + name + ".ser").save(data);
}
 
开发者ID:charite,项目名称:jannovar,代码行数:26,代码来源:BuildExampleJannovarDB.java

示例7: getSection

import org.ini4j.Ini; //导入方法依赖的package包/类
private Section getSection(File serversFile) throws FileNotFoundException, IOException {
    FileInputStream is = new FileInputStream(serversFile);
    Ini ini = new Ini();
    try {
        ini.load(is);
    } finally {
        is.close();
    }
    return ini.get("global");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SvnConfigFilesTest.java

示例8: loadConfig

import org.ini4j.Ini; //导入方法依赖的package包/类
private static void loadConfig() throws IOException {
    determineConfigDir();

    File configFile = new File(configDir + "/server.ini");
    if(!configFile.exists() || !configFile.isFile()) {
        Util.copyResourceTo("default.ini", configFile);
    }

    Ini conf = new Ini();
    conf.load(configFile);

    configuration = new NectarServerConfiguration(conf);
}
 
开发者ID:jython234,项目名称:nectar-server,代码行数:14,代码来源:NectarServerApplication.java

示例9: loadIni

import org.ini4j.Ini; //导入方法依赖的package包/类
public static IniEntity loadIni(String fileName) throws IOException {
    Config cfg = new Config();
    URL url = ConfigLoader.class.getClassLoader().getResource(fileName);
    cfg.setMultiSection(true);
    Ini ini = new Ini();
    ini.setConfig(cfg);
    ini.load(url);
    return new IniEntity(ini);
}
 
开发者ID:nuls-io,项目名称:nuls,代码行数:10,代码来源:ConfigLoader.java

示例10: sample04

import org.ini4j.Ini; //导入方法依赖的package包/类
void sample04(URL location) throws IOException
    {
        Config cfg = new Config();

        cfg.setMultiOption(true);
        Ini ini = new Ini();

        ini.setConfig(cfg);
        ini.load(location);
        Ini.Section sec = ini.get("sneezy");
        Dwarf sneezy = sec.as(Dwarf.class);
        int[] numbers = sneezy.getFortuneNumber();

        //
        // same as above but with unmarshalling...
        //
        DwarfBean sneezyBean = new DwarfBean();

        sec.to(sneezyBean);
        numbers = sneezyBean.getFortuneNumber();

//}
        assertArrayEquals(DwarfsData.sneezy.fortuneNumber, numbers);
        assertEquals(DwarfsData.sneezy.fortuneNumber.length, sec.length("fortuneNumber"));
        assertArrayEquals(DwarfsData.sneezy.fortuneNumber, sneezy.getFortuneNumber());
        assertArrayEquals(DwarfsData.sneezy.fortuneNumber, sneezyBean.getFortuneNumber());
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:28,代码来源:BeanTutorial.java

示例11: loadDwarfsIni

import org.ini4j.Ini; //导入方法依赖的package包/类
public static Ini loadDwarfsIni(Config config) throws Exception
{
    Ini ini = new Ini();

    ini.setConfig(config);
    ini.load(Helper.class.getClassLoader().getResourceAsStream(DWARFS_INI));

    return ini;
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:10,代码来源:Helper.java

示例12: loadTaleIni

import org.ini4j.Ini; //导入方法依赖的package包/类
public static Ini loadTaleIni(Config config) throws Exception
{
    Ini ini = new Ini();

    ini.setConfig(config);
    ini.load(Helper.class.getClassLoader().getResourceAsStream(TALE_INI));

    return ini;
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:10,代码来源:Helper.java

示例13: parse

import org.ini4j.Ini; //导入方法依赖的package包/类
private boolean parse() {
    Ini ini = new Ini();
    try {
        ini.load(file);

        Section smtp = ini.get("smtp");
        smtpPort = Integer.parseInt(smtp.get("port"));
        host = smtp.get("host");

        Section imap = ini.get("imap");
        imapPort = Integer.parseInt(imap.get("port"));

        Section db = ini.get("database");
        salt = db.get("salt");
        maxMailSize = Long.parseLong(db.get("max_mail_size"));

        Section keys = ini.get("keys");
        keystore = keys.get("keystore");
        keyPassword = keys.get("password");
        forceSSL = Boolean.parseBoolean(keys.get("forcessl"));

        Section debug = ini.get("debug");
        if (debug != null) {
            this.debug = Boolean.parseBoolean(debug.get("messages"));
        }

        return true;

    } catch (Exception e) {
        JustLogger.logger().severe("Error while reading config: " + e.getLocalizedMessage());
    }
    return false;
}
 
开发者ID:LukWebsForge,项目名称:JustMail,代码行数:34,代码来源:Config.java

示例14: read

import org.ini4j.Ini; //导入方法依赖的package包/类
/**
 * Creates an instance of GitConfig by reading information from the specified {@code .git/config} file.
 * <p/>
 * If some section is invalid, it is skipped, and a warning is reported.
 */
@NotNull
static GitConfig read(@NotNull GitPlatformFacade platformFacade, @NotNull File configFile) {
  GitConfig emptyConfig = new GitConfig(Collections.<Remote>emptyList(), Collections.<Url>emptyList(),
                                        Collections.<BranchConfig>emptyList());
  if (!configFile.exists()) {
    LOG.info("No .git/config file at " + configFile.getPath());
    return emptyConfig;
  }

  Ini ini = new Ini();
  ini.getConfig().setMultiOption(true);  // duplicate keys (e.g. url in [remote])
  ini.getConfig().setTree(false);        // don't need tree structure: it corrupts url in section name (e.g. [url "http://github.com/"]
  try {
    ini.load(configFile);
  }
  catch (IOException e) {
    LOG.warn("Couldn't load .git/config file at " + configFile.getPath(), e);
    return emptyConfig;
  }

  IdeaPluginDescriptor plugin = platformFacade.getPluginByClassName(GitConfig.class.getName());
  ClassLoader classLoader = plugin == null ?
                            GitConfig.class.getClassLoader() :   // null e.g. if IDEA is started from IDEA
                            plugin.getPluginClassLoader();

  Pair<Collection<Remote>, Collection<Url>> remotesAndUrls = parseRemotes(ini, classLoader);
  Collection<BranchConfig> trackedInfos = parseTrackedInfos(ini, classLoader);

  return new GitConfig(remotesAndUrls.getFirst(), remotesAndUrls.getSecond(), trackedInfos);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GitConfig.java

示例15: load

import org.ini4j.Ini; //导入方法依赖的package包/类
@Override
protected void load(Path path, byte[] data) throws Exception {
	Map<String, Map<Integer, String>> outMap = new HashMap<>();

	Ini ini = new Ini();
	ini.load(new ByteArrayInputStream(data));

	for(final Section section : ini.values()) {
		outMap.put(section.getName(), parseInibinKeys(ini.get(section.getName())));
	}

	m_InibinViewer.setKeyMappings(outMap);
}
 
开发者ID:vs49688,项目名称:RAFTools,代码行数:14,代码来源:Controller.java


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