Skip to content

Latest commit

 

History

History
63 lines (52 loc) · 1.91 KB

README.MD

File metadata and controls

63 lines (52 loc) · 1.91 KB

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'
}