read

fun read(file: File): Map<String, Any?>

Reads and parses a YAML file into a flat/nested map.

If the file does not exist, an empty map is returned rather than throwing an exception. The file is read using UTF-8 encoding and the underlying java.io.Reader is closed automatically after parsing.

This method is thread-safe - each thread uses its own Yaml parser instance.

Return

A map representing the top-level YAML mapping, or an empty map if the file does not exist or contains no mappings.

Parameters

file

The YAML file to read.