public class TOML:
Loads, parses, serializes and saves TOML 1.1 documents.
Parsed TOML tables become SortedMap<String, Object> values and arrays become Klyn lists. Serialization accepts any Map<String, Object>, including SortedMap and HashMap. Strings, signed 64-bit integers, doubles and booleans retain their natural Klyn type. Offset date-times become DateTime; local temporal values become TOMLLocalDateTime, TOMLLocalDate or TOMLLocalTime. Comments and original lexical formatting are intentionally not retained by the data model.
import klyn.io.toml
config = TOML.parse("""title = "Klyn"
[server]
port = 8080
""")
server = config["server"] as SortedMap<String, Object>
assert server["port"] == 8080l| Modifier and Type | Member | Description |
|---|---|---|
| public static | loadload(filename as String) as SortedMap<String, Object> throws IOException, TOMLParseException: |
Loads a TOML document from a UTF-8 file. |
| public static | loadload(path as Path) as SortedMap<String, Object> throws IOException, TOMLParseException: |
Loads a TOML document from a path. |
| public static | loadload(reader as TextReader) as SortedMap<String, Object> throws IOException, TOMLParseException: |
Loads all remaining TOML text from a reader. |
| public static | parseparse(text as String) as SortedMap<String, Object> throws TOMLParseException: |
Parses TOML text into its natural Klyn representation. |
| public static | savesave(filename as String, document as Map<String, Object>) as Void throws IOException, TOMLWriteException: |
Saves a root table to a UTF-8 file, replacing existing content. |
| public static | savesave(path as Path, document as Map<String, Object>) as Void throws IOException, TOMLWriteException: |
Saves a root table to a path, replacing existing content. |
| public static | savesave(writer as TextWriter, document as Map<String, Object>) as Void throws IOException, TOMLWriteException: |
Writes a root table to an existing text writer. |
| public static | stringifystringify(document as Map<String, Object>) as String throws TOMLWriteException: |
Serializes a root table as deterministic TOML text. |