• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Wini类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AbstractContext

import org.ini4j.Wini; //导入依赖的package包/类
public AbstractContext() {
	// Exists only to defeat instantiation
	try {
		StringBuilder sb = new StringBuilder();

		sb.append(System.getProperty("user.home"));
		sb.append(File.separator);
		sb.append(".river-framework");
		sb.append(File.separator);
		sb.append(getConfigurationFileName());

		String location = sb.toString();

		Wini context = new Wini(new File(location));

		testDatabaseServer = context.get("default", "test-database-server");
		testDatabasePath = context.get("default", "test-database-path");
		remoteDatabaseServer = context.get("default", "remote-database-server");
		remoteDatabasePath = context.get("default", "remote-database-path");

	} catch (Exception e) {
		throw new RiverException(e);
	}
}
 
开发者ID:mariosotil,项目名称:river-framework,代码行数:25,代码来源:AbstractContext.java


示例2: sample01

import org.ini4j.Wini; //导入依赖的package包/类
void sample01(String filename) throws IOException
    {
        Wini ini = new Wini(new File(filename));
        int age = ini.get("happy", "age", int.class);
        double height = ini.get("happy", "height", double.class);
        String dir = ini.get("happy", "homeDir");

//}
//| ... assuming there is a section with name <<<happy>>>, which contains at least
//| the following options: <<<age>>>, <<<height>>> and <<<homeDir>>>, something like
//| this:
//|
//|+---------+
//| [happy]
//| age = 99
//| height = 77.66
//| homeDir = /home/happy
//|+---------+
//|
//|
        assertEquals(DwarfsData.happy.age, age);
        assertEquals(DwarfsData.happy.height, height, Helper.DELTA);
        assertEquals(DwarfsData.happy.homeDir, dir);
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:25,代码来源:OneMinuteTutorial.java


示例3: sample02

import org.ini4j.Wini; //导入依赖的package包/类
void sample02(String filename) throws IOException
    {
        Wini ini = new Wini(new File(filename));

        ini.put("sleepy", "age", 55);
        ini.put("sleepy", "weight", 45.6);
        ini.store();

//}
//| ... and then file will have a section <<<sleepy>>> and this section
//| will contains at least two options: <<<age>>> with value <<<55>>> and <<<weight>>>
//| with value <<<45.6>>>, something like this:
//|
//|+---------+
//| [sleepy]
//| age = 55
//| weight = 45.6
//|+---------+
//|
        assertEquals(55, (int) ini.get(Dwarfs.PROP_SLEEPY, Dwarf.PROP_AGE, int.class));
        assertEquals(45.6, ini.get(Dwarfs.PROP_SLEEPY, Dwarf.PROP_WEIGHT, double.class), Helper.DELTA);
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:23,代码来源:OneMinuteTutorial.java


示例4: save

import org.ini4j.Wini; //导入依赖的package包/类
public void save() throws IOException {
	if (this.inifile == null || this.inifile.isEmpty()) {
		return;
	}
	File f = new File(this.inifile);
	if (!f.exists()) {
		f.getParentFile().mkdirs();
		f.createNewFile();
	}
	Wini ini = new Wini(f);
	ini.put("server", "host", this.bindHost);
	ini.put("server", "port", this.bindPort);
	ini.put("server", "thread", this.threadNum);
	ini.put("redis", "host", this.redisHost);
	ini.put("redis", "port", this.redisPort);
	ini.put("redis", "db", this.redisDb);
	ini.put("watch", "interval", this.interval);
	ini.store();
}
 
开发者ID:pyloque,项目名称:captain,代码行数:20,代码来源:Config.java


示例5: generatePatchDesc

import org.ini4j.Wini; //导入依赖的package包/类
public static String generatePatchDesc(ME3TweaksPatchPackage pack) {
	Wini ini = new Wini();

	// put modmanager, PATCHINFO
	ini.put("ModManager", "cmmver", pack.getTargetversion());
	ini.put("PatchInfo", "patchname", pack.getPatchname());
	ini.put("PatchInfo", "patchdesc", pack.getPatchdesc());
	ini.put("PatchInfo", "patchdev", pack.getPatchdev());
	ini.put("PatchInfo", "patchver", pack.getPatchver());
	ini.put("PatchInfo", "targetmodule", pack.getTargetmodule());
	ini.put("PatchInfo", "targetfile", pack.getTargetfile());
	ini.put("PatchInfo", "targetsize", pack.getTargetsize());
	ini.put("PatchInfo", "finalizer", pack.isFinalizer());
	ini.put("PatchInfo", "me3tweaksid", pack.getMe3tweaksid());

	ByteArrayOutputStream os = new ByteArrayOutputStream();
	try {
		ini.store(os);
		return new String(os.toByteArray(), "ASCII");
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return "";
}
 
开发者ID:Mgamerz,项目名称:me3modmanager,代码行数:26,代码来源:Patch.java


示例6: Mod

import org.ini4j.Wini; //导入依赖的package包/类
/**
 * Loads a moddesc from a stream of bytes. Typically this is from a
 * compressed archive.
 * 
 * @param bytes
 */
public Mod(ByteArrayInOutStream bytes) {
	modDescFile = new File(System.getProperty("user.dir"));
	ignoreLoadErrors = true;
	modifyString = "";
	jobs = new ArrayList<ModJob>();
	try {
		Wini wini = new Wini();
		wini.load(bytes.getInputStream());
		readDesc(wini);
	} catch (Exception e) {
		ModManager.debugLogger.writeErrorWithException("Error reading moddesc.ini from stream:", e);
		setValidMod(false);
		return;
	}
}
 
开发者ID:Mgamerz,项目名称:me3modmanager,代码行数:22,代码来源:Mod.java


示例7: unserialize

import org.ini4j.Wini; //导入依赖的package包/类
@Override
public void unserialize(Wini ini) {
    String fontFamily = ini.get(INI_SECTION_TICKER, INI_VALUE_FONT_FAMILY);
    if (fontFamily != null && fontFamily.length() > 0) {
        this.fontFamily = fontFamily;
    }

    int fontSize = ini.get(INI_SECTION_TICKER, INI_VALUE_FONT_SIZE, int.class);
    if (fontSize > 0) {
        this.fontSize = fontSize;
    }

    String backgroundColor = ini.get(INI_SECTION_TICKER, INI_VALUE_BACKGROUND_COLOR);
    if (backgroundColor != null && backgroundColor.length() > 0) {
        this.backgroundColor = Color.web(backgroundColor);
    }

    String textColor = ini.get(INI_SECTION_TICKER, INI_VALUE_TEXT_COLOR);
    if (textColor != null && textColor.length() > 0) {
        this.textColor = Color.web(textColor);
    }
}
 
开发者ID:scheb,项目名称:party-projector,代码行数:23,代码来源:TickerStyle.java


示例8: create

import org.ini4j.Wini; //导入依赖的package包/类
/**
 * Creates a car counter instance.
 *
 * @param ini the configuration file.
 * @return the car counter.
 */
public CarCounter create(Wini ini)
{
    String implementation = ini.get("Counting", "implementation", String.class);

    if ("opencv".equals(implementation))
    {
        return new OpencvCarCounter();
    }
    else if ("noop".equals(implementation))
    {
        return new NoopCarCounter();
    }
    else
    {
        throw new IllegalStateException("Unknown counting backend: " + implementation);
    }
}
 
开发者ID:tmyroadctfig,项目名称:car-counter,代码行数:24,代码来源:CarCounterFactory.java


示例9: DefaultProcessor

import org.ini4j.Wini; //导入依赖的package包/类
public DefaultProcessor(Wini ini)
{
    dateTimeExtractor = new MotionDateTimeExtractor();// TODO: via config
    carCounter = new CarCounterFactory().create(ini);
    storage = new StorageFactory().create(ini);

    String incoming = ini.get("Processing", "incoming", String.class);
    Preconditions.checkState(StringUtils.isNotBlank(incoming), "An incoming directory is required");
    incomingDirectory = Paths.get(incoming);

    if (!Files.isDirectory(incomingDirectory))
    {
        throw new IllegalStateException("Incoming path is not an existing directory: " + incoming);
    }

    String data = ini.get("Processing", "data", String.class);
    Preconditions.checkState(StringUtils.isNotBlank(data), "An data directory is required");
    dataDirectory = Paths.get(data);

    if (!Files.isDirectory(dataDirectory))
    {
        throw new IllegalStateException("Data path is not an existing directory: " + data);
    }

    logger.info(String.format("Starting processor: incoming:[%s] data:[%s]", incoming, data));
}
 
开发者ID:tmyroadctfig,项目名称:car-counter,代码行数:27,代码来源:DefaultProcessor.java


示例10: setUp

import org.ini4j.Wini; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    dbFile = Files.createTempFile("test", ".db");

    String iniValue = String.format(
        "[Storage]\n" +
        "implementation = sqlite\n" +
        "database = %s\n",
        dbFile);

    try (InputStream stream = IOUtils.toInputStream(iniValue, StandardCharsets.UTF_8))
    {
        ini = new Wini(stream);
    }
}
 
开发者ID:tmyroadctfig,项目名称:car-counter,代码行数:17,代码来源:TestSqliteStorage.java


示例11: IniParser

import org.ini4j.Wini; //导入依赖的package包/类
/**
 * Loads an ini file
 * @param iniFile
 * @throws FileNotFoundException
 */
public IniParser( String iniFile ) throws FileNotFoundException {
	if ( iniFile == null ) {
		iniFile = "config";
	}
	
	if ( new File( iniFile ).isDirectory() || !new File( iniFile ).exists() ) {
		throw new FileNotFoundException( "INI-Configfile not found: " + iniFile );
	}
	
	try {
		ini = new Wini( new File( iniFile ) );
	} catch ( IOException e ) {
		e.printStackTrace();
		throw new FileNotFoundException( "INI-Configfile not found: " + iniFile );
	}
	
}
 
开发者ID:RalfHerzog,项目名称:java_pwman3,代码行数:23,代码来源:IniParser.java


示例12: sample02

import org.ini4j.Wini; //导入依赖的package包/类
void sample02(String filename) throws IOException
    {
        Wini ini = new Wini(new File(filename));

        ini.put("sleepy", "age", 55);
        ini.put("sleepy", "weight", 45.6);
        ini.store();

//}
//| ... and then file will have a section <<<sleepy>>> and this section
//| will contains at least two options: <<<age>>> with value <<<55>>> and <<<weight>>>
//| with value <<<45.6>>>, something like this:
//|
//|+---------+
//| [sleepy]
//| age = 55
//| weight = 45.6
//|+---------+
//|
        assertEquals(55, (int) ini.get(Dwarfs.PROP_SLEEPY, Dwarf.PROP_AGE, int.class));
        assertEquals(45.6, (double) ini.get(Dwarfs.PROP_SLEEPY, Dwarf.PROP_WEIGHT, double.class), Helper.DELTA);
    }
 
开发者ID:qxo,项目名称:ini4j,代码行数:23,代码来源:OneMinuteTutorial.java


示例13: ROMData

import org.ini4j.Wini; //导入依赖的package包/类
public ROMData(String header) throws IOException {
    this(
        new Wini(
            ROMData.class.getClassLoader().getResourceAsStream("roms.ini")
        ),
        header
    );
}
 
开发者ID:hugmanrique,项目名称:PokeData,代码行数:9,代码来源:ROMData.java


示例14: getUrl

import org.ini4j.Wini; //导入依赖的package包/类
public static String getUrl(String tipo, String servico) throws CteException {

        try {
        	
        	
            ConfiguracoesIniciais config = ConfiguracoesIniciais.getInstance();
            String secao = tipo + "_" + config.getEstado() + "_"
                    + (config.getAmbiente().equals(ConstantesCte.AMBIENTE.HOMOLOGACAO) ? "H" : "P");

            InputStream is = WebServiceUtil.class.getResourceAsStream("/WebServicesCte.ini");

            Wini ini = new Wini(is);
            String url = ini.get(secao, "Usar");
            if (url == null) {
                url = secao;
            }
            
            if (!config.getEstado().equals(Estados.MG)
                    || !config.getEstado().equals(Estados.MS)
                    || !config.getEstado().equals(Estados.MT)
                    || !config.getEstado().equals(Estados.RS)
                    || !config.getEstado().equals(Estados.SP)
                    || !config.getEstado().equals(Estados.PR)) {
                secao = url;
            }

            if (servico.equals(ConstantesCte.SERVICOS.DISTRIBUICAO_DFE)) {
                url = ini.get("CTe_AN_"+(config.getAmbiente().equals(ConstantesCte.AMBIENTE.HOMOLOGACAO) ? "H" : "P"), servico);
            } else {
                url = ini.get(secao, servico + "_" + config.getVersao());
            }

            System.out.println("Versão Cte: " + config.getVersao() + " - WebService: " + url);
            return url;

        } catch (IOException e) {
            throw new CteException(e.getMessage());
        }

    }
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:41,代码来源:WebServiceUtil.java


示例15: getUrlConsultaCadastro

import org.ini4j.Wini; //导入依赖的package包/类
public static String getUrlConsultaCadastro(String uf) throws NfeException {
	
		String tipo = ConstantesUtil.NFE;
		String servico = ConstantesUtil.SERVICOS.CONSULTA_CADASTRO;
	try {
		
		ConfiguracoesIniciaisNfe config = ConfiguracoesIniciaisNfe.getInstance();
		String secao = tipo + "_" + uf.toUpperCase() + "_"
				+ (config.getAmbiente().equals(ConstantesUtil.AMBIENTE.HOMOLOGACAO) ? "H" : "P");
		
		InputStream is = WebServiceUtil.class.getResourceAsStream("/WebServices.ini");
		
		Wini ini = new Wini(is);
		String url = ini.get(secao, "Usar");
		
		url = ini.get(secao, servico);
		
		if(ObjetoUtil.isEmpty(url)){
			throw new NfeException("WebService de "+servico+" não encontrado para "+uf);
		}
		
		System.out.println("WebService - " + url);
		return url;
		
	} catch (IOException e) {
		throw new NfeException(e.getMessage());
	}
	
}
 
开发者ID:Samuel-Oliveira,项目名称:Java_NFe,代码行数:30,代码来源:WebServiceUtil.java


示例16: load

import org.ini4j.Wini; //导入依赖的package包/类
public void load() throws IOException {
	if (this.inifile == null || this.inifile.isEmpty()) {
		return;
	}
	File f = new File(this.inifile);
	if (f.exists() && f.isFile()) {
		Wini ini = new Wini(f);
		String bindHost = ini.get("server", "host", String.class);
		Integer bindPort = ini.get("server", "port", Integer.class);
		Integer threadNum = ini.get("server", "thread", Integer.class);
		String redisHost = ini.get("redis", "host", String.class);
		Integer redisPort = ini.get("redis", "port", Integer.class);
		Integer redisDb = ini.get("redis", "db", Integer.class);
		Integer interval = ini.get("watch", "interval", Integer.class);
		if (bindHost != null) {
			this.bindHost = bindHost;
		}
		if (bindPort != null) {
			this.bindPort = bindPort;
		}
		if(threadNum != null) {
			this.threadNum = threadNum;
		}
		if (redisHost != null) {
			this.redisHost = redisHost;
		}
		if (redisPort != null) {
			this.redisPort = redisPort;
		}
		if (redisDb != null) {
			this.redisDb = redisDb;
		}
		if (interval != null) {
			this.interval = interval;
		}
	}
}
 
开发者ID:pyloque,项目名称:captain,代码行数:38,代码来源:Config.java


示例17: loadMod

import org.ini4j.Wini; //导入依赖的package包/类
/**
 * Reads moddesc and sets up the mod object. This is mainly used from the
 * main Mod(moddesc.ini) method. This method was externalized to allow for
 * setting up the the mod object before this method is processed.
 * 
 * @param filepath
 *            Moddesc.ini file to load
 */
public void loadMod(String filepath) {
	modifyString = "";
	modDescFile = new File(filepath);
	setModPath(ModManager.appendSlash(modDescFile.getParent()));
	jobs = new ArrayList<ModJob>();
	try {
		readDesc(new Wini(modDescFile));
	} catch (Exception e) {
		ModManager.debugLogger.writeErrorWithException("Error reading moddesc.ini:", e);
		setValidMod(false);
		return;
	}
}
 
开发者ID:Mgamerz,项目名称:me3modmanager,代码行数:22,代码来源:Mod.java


示例18: getDefaultLanguages

import org.ini4j.Wini; //导入依赖的package包/类
/**
 * Gets an arraylist of languages to compile by default.
 * 
 * @return
 */
public static ArrayList<String> getDefaultLanguages() {
	String defaultLang = ALL_LANG;
	Wini settingsini = ModManager.LoadSettingsINI();
	String modmakerLanguage = settingsini.get("Settings", "modmaker_language");
	if (modmakerLanguage != null && !modmakerLanguage.equals("")) {
		//language setting exists
		defaultLang = modmakerLanguage;
	}

	return getLanguages(defaultLang);
}
 
开发者ID:Mgamerz,项目名称:me3modmanager,代码行数:17,代码来源:ModMakerEntryWindow.java


示例19: serialize

import org.ini4j.Wini; //导入依赖的package包/类
@Override
public void serialize(Wini ini) {
    ini.put(INI_SECTION_TICKER, INI_VALUE_FONT_FAMILY, this.fontFamily);
    ini.put(INI_SECTION_TICKER, INI_VALUE_FONT_SIZE, fontSize);
    ini.put(INI_SECTION_TICKER, INI_VALUE_BACKGROUND_COLOR, toRGBCode(backgroundColor));
    ini.put(INI_SECTION_TICKER, INI_VALUE_TEXT_COLOR, toRGBCode(textColor));
}
 
开发者ID:scheb,项目名称:party-projector,代码行数:8,代码来源:TickerStyle.java


示例20: serialize

import org.ini4j.Wini; //导入依赖的package包/类
@Override
public void serialize(Wini ini) {
    ini.put(INI_SECTION_PROJECTOR, INI_VALUE_POSX, posX);
    ini.put(INI_SECTION_PROJECTOR, INI_VALUE_POSY, posY);
    ini.put(INI_SECTION_PROJECTOR, INI_VALUE_WIDTH, width);
    ini.put(INI_SECTION_PROJECTOR, INI_VALUE_HEIGHT, height);
}
 
开发者ID:scheb,项目名称:party-projector,代码行数:8,代码来源:ProjectorSettings.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProvisionRequest类代码示例发布时间:2022-05-21
下一篇:
Java EntityViewRenderEvent类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap