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


Java Ini.get方法代码示例

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


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

示例1: merge

import org.ini4j.Ini; //导入方法依赖的package包/类
/**
 * Merges only sections/keys/values into target which are not already present in source
 * 
 * @param source the source ini file
 * @param target the target ini file in which the values from the source file are going to be merged
 */
private void merge(Ini source, Ini target) {
    for (Iterator<String> itSections = source.keySet().iterator(); itSections.hasNext();) {
        String sectionName = itSections.next();
        Ini.Section sourceSection = source.get( sectionName );
        Ini.Section targetSection = target.get( sectionName );

        if(targetSection == null) {
            targetSection = target.add(sectionName);
        }

        for (Iterator<String> itVariables = sourceSection.keySet().iterator(); itVariables.hasNext();) {
            String key = itVariables.next();

            if(!targetSection.containsKey(key)) {
                targetSection.put(key, sourceSection.get(key));
            }
        }            
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SvnConfigFiles.java

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

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

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

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

示例6: sample04

import org.ini4j.Ini; //导入方法依赖的package包/类
void sample04(Ini ini)
    {
        Ini.Section sneezy = ini.get("sneezy");
        String n1 = sneezy.get("fortuneNumber", 0);  // = 11
        String n2 = sneezy.get("fortuneNumber", 1);  // = 22
        String n3 = sneezy.get("fortuneNumber", 2);  // = 33
        String n4 = sneezy.get("fortuneNumber", 3);  // = 44

        // ok, lets do in it easier...
        int[] n = sneezy.getAll("fortuneNumber", int[].class);
//}
        // #2817399

        assertEquals("11", n1);
        assertEquals("22", n2);
        assertEquals("33", n3);
        assertEquals("44", n4);
        assertEquals(4, n.length);
        assertEquals(11, n[0]);
        assertEquals(22, n[1]);
        assertEquals(33, n[2]);
        assertEquals(44, n[3]);
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:24,代码来源:IniTutorial.java

示例7: sample01

import org.ini4j.Ini; //导入方法依赖的package包/类
void sample01(Ini ini)
    {
        Ini.Section sec = ini.get("happy");
        Dwarf happy = sec.as(Dwarf.class);
        int age = happy.getAge();
        URI homePage = happy.getHomePage();

        happy.setWeight(45.55);

//}
//|
//| The <<<happy instanceof Dwarf>>> relation is of course fulfilled in the
//| example above.
//|
        assertEquals(DwarfsData.happy.homePage.toString(), homePage.toString());
        assertEquals(DwarfsData.happy.age, age);
        assertEquals(45.55, happy.getWeight(), 0.01);
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:19,代码来源:BeanTutorial.java

示例8: setupLanguage

import org.ini4j.Ini; //导入方法依赖的package包/类
static void setupLanguage(String id, boolean silent) throws IOException {
    File f = new File("messages.ini");
    Config conf = new Config(f).setDefaultConfig(getDefaultIni()).compare();
    if (conf.wasChanged() && !silent)
        System.out.println("[Config] " + f.getName() + " has been updated.");
    final Ini ini = conf.getIni();

    if (!ini.containsKey(id))
        Exceptions.handle(new Exception("Language code " + id + " is not valid!"), "Language code " + id + " is not valid!", true);
    Section section = ini.get(id);
    for (String key : section.keySet()) {
        msg.put(key, section.get(key));
    }
    msg.put("help-dialog",
            "[URL=https://sprum.ml]Sprummlbot[/URL] v" + Vars.VERSION + " by Scrumplex.");
}
 
开发者ID:Scrumplex,项目名称:Sprummlbot,代码行数:17,代码来源:Messages.java

示例9: createInstanceTemplate

import org.ini4j.Ini; //导入方法依赖的package包/类
/**
 * Create an instance template with data from the configuration file.
 */
private InstanceTemplate createInstanceTemplate(Ini config, String templateName) {

    String instanceImage = "";
    String instanceType = "";

    Map<String, String> configs = new HashMap<String, String>();

    configs.put("subnetId", config.get("instance", "subnetId"));
    configs.put("securityGroupsIds", config.get("instance", "securityGroupId"));
    configs.put("instanceNamePrefix", config.get("instance", "namePrefix"));

    instanceImage = config.get("instance", "image");
    instanceType = config.get("instance", "type");

    return InstanceTemplate.builder()
            .name(templateName)
            .image(instanceImage)
            .type(instanceType)
            .config(configs)
            .build();
}
 
开发者ID:chirudera,项目名称:cloud-automation-toolkit,代码行数:25,代码来源:CommonParameters.java

示例10: getLocationFromIni

import org.ini4j.Ini; //导入方法依赖的package包/类
public static String getLocationFromIni( String iniLocation )
	throws IOException
{
	// Format: "/Section/Key:URL_to_ini"
	String[] ss = iniLocation.split( ":", 2 );
	assertIOException( ss.length < 2, "invalid ini location; the format is /Section/Key:URL_to_ini" );
	
	String[] iniPath = ss[0].split( "/", 3 );
	assertIOException( iniPath.length < 3, "path to ini content is not well-formed; the format is /Section/Key" );
	
	URL iniURL = new URL( ss[1] );
	Ini ini = new Ini( new InputStreamReader( iniURL.openStream() ) );
	
	Ini.Section section = ini.get( iniPath[1] );
	assertIOException( section == null, "could not find section " + iniPath[1] + " in ini" );
	
	String retLocation = section.get( iniPath[2] );
	assertIOException( retLocation == null, "could not find key " + iniPath[2] + " in section " + iniPath[1] + " in ini" );
	
	return retLocation;
}
 
开发者ID:jolie,项目名称:jolie,代码行数:22,代码来源:AutoHelper.java

示例11: Initialize

import org.ini4j.Ini; //导入方法依赖的package包/类
public static void Initialize()
{
    try
    {
        Ini ini = new Ini(new File("nwnx2.ini"));
        _host = ini.get("ODBC2", "server");
        _username = ini.get("ODBC2", "user");
        _password = ini.get("ODBC2", "pass");
        _schema = ini.get("ODBC2", "db");
    }
    catch (Exception ex)
    {
        ErrorHelper.HandleException(ex, "DataAccess Initialize()");
    }

    CreateSessionFactory();
}
 
开发者ID:zunath,项目名称:Contagion_JVM,代码行数:18,代码来源:DataAccess.java

示例12: createUserConfFile

import org.ini4j.Ini; //导入方法依赖的package包/类
private void createUserConfFile(Ca ca,
		Map<String, String> subjAlt) throws Exception {
	
	File f = new File(ca.getUserConfFileName());
	Ini confFile = new Ini(f);
	Ini.Section sect;
	sect = confFile.get("v3_req");
		sect.put("basicConstraints", "CA:FALSE");
		sect.put("keyUsage", "cRLSign, digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign");
		sect.put("subjectKeyIdentifier", "hash");
		sect.put("certificatePolicies", "@polsection");
	sect = confFile.get("v3_ca"); 
		sect.put("basicConstraints", "critical,CA:FALSE");
		sect.put("keyUsage", "digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign");
		sect.put("authorityKeyIdentifier", "keyid,issuer:always");
		sect.put("certificatePolicies", "@polsection");
		sect.put("subjectAltName", "@subject_alt_section");
	sect = confFile.get("subject_alt_section");
		sect.clear();
		for (String key : subjAlt.keySet()) {
			sect.put(key, subjAlt.get(key));
		}
	confFile.store();
}
 
开发者ID:robsonsmartins,项目名称:fiap-mba-java-projects,代码行数:25,代码来源:IcpBrasilDAO.java

示例13: createCaConfFile

import org.ini4j.Ini; //导入方法依赖的package包/类
@Override
protected void createCaConfFile(Ca rootCa, Ca ca, String crlURI,
		String cpsURI, String subject) throws Exception {
	
	super.createCaConfFile(rootCa, ca, crlURI, cpsURI, subject);
	File f = new File(ca.getConfFileName());
	Ini confFile = new Ini(f);
	Ini.Section sect;
	sect = confFile.get("v3_req");
		sect.put("certificatePolicies", "@polsection1, @polsection2");
	sect = confFile.get("v3_ca");
		sect.put("authorityKeyIdentifier", "keyid,issuer:always");
		sect.put("certificatePolicies", "@polsection1, @polsection2");
	sect = confFile.add("polsection1"); 
		sect.put("policyIdentifier", cpsCaA1);
		sect.put("CPS.1", "\"" + cpsURI + "\"");
	sect = confFile.add("polsection2"); 
		sect.put("policyIdentifier", cpsCaA3);
		sect.put("CPS.1", "\"" + cpsURI + "\"");
	confFile.store();
}
 
开发者ID:robsonsmartins,项目名称:fiap-mba-java-projects,代码行数:22,代码来源:CaDAO.java

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

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


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