decodeFromReader

inline fun <T> Toml.decodeFromReader(reader: TomlReader): T(source)

Deserializes the content of reader into a value of type T using the serializer retrieved from reified type parameter.

Parameters

reader

MUST contain a TOML file, as this method delegates parsing to Toml.parseToTomlTable.

Throws

TomlDecodingException

if the content cannot be parsed into TomlTable or cannot be deserialized.


inline fun <T> Toml.decodeFromReader(reader: TomlReader, vararg keys: Any?): T(source)

Parses the content of reader into a TomlTable and deserializes the corresponding element fetched with keys into a value of type T using the serializer retrieved from reified type parameter.

Parameters

reader

MUST contain a TOML file, as this method delegates parsing to Toml.parseToTomlTable.

keys

the path which leads to the value. Each one item is a single segment. If a TomlArray is met, any direct child segment must be Int or String (will be parsed into integer).

See also

Throws

TomlDecodingException

if the content cannot be parsed into TomlTable or the element cannot be deserialized.

NonPrimitiveKeyException

if provided non-primitive keys.