Skip to content

支持注释输出的Toml4J

License

LGPL-3.0, MIT licenses found

Licenses found

LGPL-3.0
LICENSE
MIT
LICENSE-TOML4J
Notifications You must be signed in to change notification settings

KenRouKoro/ctoml4j

Repository files navigation

ctoml4j

GitHub last commit (by committer) GitHub Workflow Status (with event) GitHub release GitHub commit activity (branch) GitHub

GitHub top language forthebadge

ctoml4j是基于TOML4J修改而来的TOML 0.4.0解析库
增加了输出注释支持

示例

static class AClass {
    @OutputAnnotation("Hello")
    int anInt = 1;
    @OutputAnnotation(value = "World" ,at = Location.Right)
    int[] anArray = { 2, 3 };
}

TomlWriter tomlWriter = new TomlWriter();
AClass obj = new AClass();

Map<String, Object> map = new HashMap<String, Object>();
int[] intArray = { 2, 3 };
map.put("anInt", 1);
map.put("anArray", intArray);

String tomlString = tomlWriter.write(obj);
tomlString = tomlWriter.write(map);

tomlWriter.write(obj, new File("path/to/file"));
tomlWriter.write(obj, new ByteArrayOutputStream());
tomlWriter.write(obj, new OutputStreamWriter(anOutputStream));

/*
All methods output:

# Hello
anInt = 1
anArray = [2, 3] # World
*/

如何使用

First

	allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

And enjoy it

dependencies {
    implementation 'com.github.KenRouKoro:ctoml4j:1.0.0'
}

About

支持注释输出的Toml4J

Resources

License

LGPL-3.0, MIT licenses found

Licenses found

LGPL-3.0
LICENSE
MIT
LICENSE-TOML4J

Stars

Watchers

Forks

Packages

 
 
 

Languages