8 Star 47 Fork 4

法欧特斯卡雷特 / mini-ini

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Demo1.java 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
ForteScarlet 提交于 2020-07-05 00:02 . update copyright
package com.forte.test;
import love.forte.minini.Ini;
import love.forte.minini.IniReader;
import love.forte.minini.reader.BufferedIniReader;
import java.io.InputStream;
/**
*
* Demo for read a ini file from stream
*
*/
public class Demo1 {
public static void main(String[] args) throws Exception {
// Get input stream from resources.
InputStream iniInput = Demo1.class.getClassLoader().getResourceAsStream("test.ini");
System.out.println(iniInput);
/*
If you want to change or use some of your own rules, you can see:
IniReader
BufferedIniReader
IniFormatterFactory (function implement: DefaultIniFormatter::new)
CommentElementFormatter
SectionElementFormatter
PropertyElementFormatter
*/
// Get ini reader by default reader: BufferedIniReader.
// By default, there is only this one implementation class. You can implement it independently.
IniReader ir = new BufferedIniReader();
// read to ini
Ini ini = ir.read(iniInput);
// show ini
System.out.println(ini);
// to properties and show
ini.toProperties().forEach((k, v) -> {
System.out.println(k + "=" + v);
});
}
}
Java
1
https://gitee.com/ForteScarlet/mini-ini.git
git@gitee.com:ForteScarlet/mini-ini.git
ForteScarlet
mini-ini
mini-ini
master

搜索帮助