8 Star 47 Fork 4

法欧特斯卡雷特 / mini-ini

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Demo2.java 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
ForteScarlet 提交于 2020-06-29 22:31 . add copyright info
package com.forte.test;
import love.forte.minini.Ini;
import love.forte.minini.IniBuilder;
/**
* Demo for create a ini and write
*/
public class Demo2 {
public static void main(String[] args) throws Exception {
// Create an IniBuilder and
IniBuilder b = new IniBuilder()
.plusComment("this is a test ini")
.skipLine(2)
.plusSection("sec1", "this is a section")
.plusProperty("key1", "value")
.plusProperty("key2", "value")
.plusProperty("key3", "value")
.plusProperty("key4", "value")
.plusProperty("key5", "value")
.plusProperty("key6", "value")
.plusSection("sec2")
.plusProperty("key1", "value")
.plusProperty("key2", "value")
.plusProperty("key3", "value")
.plusProperty("key4", "value")
.plusProperty("key5", "value")
.plusProperty("key6", "value")
;
// Build ini
final Ini ini = b.build();
System.out.println(ini);
// System.out.println("————————————————");
//
// // Write to file
// ini.write(Paths.get("F:\\test3.ini"), true);
//
// // And read it.
// Ini ri = new BufferedIniReader().read(new File("F:\\test3.ini"));
//
// // Show
// System.out.println(ri);
//
// System.out.println("————————————————");
//
// // Show by properties
// ri.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

搜索帮助