LoadSettings

class LoadSettings(val label: String = "reader", val tagConstructors: Map<Tag, ConstructNode> = emptyMap(), val defaultList: LoadSettings.CollectionProvider<MutableList<Any?>> = CollectionProvider { initialCapacity: Int -> ArrayList(initialCapacity) }, val defaultSet: LoadSettings.CollectionProvider<MutableSet<Any?>> = CollectionProvider { initialCapacity: Int -> LinkedHashSet(initialCapacity) }, val defaultMap: LoadSettings.CollectionProvider<MutableMap<Any?, Any?>> = CollectionProvider { initialCapacity: Int -> LinkedHashMap(initialCapacity) }, val versionFunction: LoadSettings.SpecVersionMutator = SpecVersionMutator { version -> if (version.major != 1) throw YamlVersionException(version) version }, val bufferSize: Int = 1024, val allowDuplicateKeys: Boolean = false, val allowRecursiveKeys: Boolean = false, val maxAliasesForCollections: Int = 50, val useMarks: Boolean = true, val customProperties: Map<SettingKey, Any> = emptyMap(), val envConfig: EnvConfig? = null, val parseComments: Boolean = false, val codePointLimit: Int = 3 * 1024 * 1024, val schema: Schema = DEFAULT_SCHEMA)(source)

Immutable configuration for loading.

Constructors

Link copied to clipboard
constructor(label: String = "reader", tagConstructors: Map<Tag, ConstructNode> = emptyMap(), defaultList: LoadSettings.CollectionProvider<MutableList<Any?>> = CollectionProvider { initialCapacity: Int -> ArrayList(initialCapacity) }, defaultSet: LoadSettings.CollectionProvider<MutableSet<Any?>> = CollectionProvider { initialCapacity: Int -> LinkedHashSet(initialCapacity) }, defaultMap: LoadSettings.CollectionProvider<MutableMap<Any?, Any?>> = CollectionProvider { initialCapacity: Int -> LinkedHashMap(initialCapacity) }, versionFunction: LoadSettings.SpecVersionMutator = SpecVersionMutator { version -> if (version.major != 1) throw YamlVersionException(version) version }, bufferSize: Int = 1024, allowDuplicateKeys: Boolean = false, allowRecursiveKeys: Boolean = false, maxAliasesForCollections: Int = 50, useMarks: Boolean = true, customProperties: Map<SettingKey, Any> = emptyMap(), envConfig: EnvConfig? = null, parseComments: Boolean = false, codePointLimit: Int = 3 * 1024 * 1024, schema: Schema = DEFAULT_SCHEMA)

Types

Link copied to clipboard
fun interface CollectionProvider<T>
Link copied to clipboard
fun interface SpecVersionMutator

Properties

Link copied to clipboard

YAML 1.2 does require unique keys. To support the backwards compatibility, it is possible to select what should happen when non-unique keys are detected.

Link copied to clipboard

Allow only non-recursive keys for maps and sets. By default, it is not allowed. Even though YAML allows using anything as a key, it may cause unexpected issues when loading recursive structures.

Link copied to clipboard
val bufferSize: Int = 1024

Buffer size for incoming data stream, in bytes. If the incoming stream is already buffered, then changing the buffer does not improve the performance

Link copied to clipboard

The max number of code points for every input YAML document in the stream. Please be aware that the byte limit depends on the encoding. The presence of the document indicators '---' or/and '...' will affect the doc size (even though they do not belong to the document content)

Link copied to clipboard

Provide a custom property to be used later

Link copied to clipboard

Default List implementation, as a function of its initial size. ArrayList is used if nothing provided.

Link copied to clipboard

Default Map implementation, as a function of its initial size. LinkedHashMap is used if nothing provided.

Link copied to clipboard

Default Set implementation, as a function of its initial size. LinkedHashSet is used if nothing provided.

Link copied to clipboard
val envConfig: EnvConfig? = null

Define EnvConfig to parse ENV format. If not set explicitly, the variable substitution is not applied.

Link copied to clipboard

Label for the input data. Can be used to improve the error message.

Link copied to clipboard

Restrict the number of aliases for collection nodes to prevent 'billion laughs attack'. The purpose of this setting is to force SnakeYAML to fail before a lot of CPU and memory resources are allocated for the parser. Aliases for scalar nodes do not count because they do not grow exponentially.

Link copied to clipboard
val parseComments: Boolean = false

Parse comments to the presentation tree (Node). False by default. Use true to parse comments to the presentation tree (Node)

Link copied to clipboard

Provide either recommended or custom schema instead of default * it.krzeminski.snakeyaml.engine.kmp.schema.DEFAULT_SCHEMA These 3 are available it.krzeminski.snakeyaml.engine.kmp.schema.FailsafeSchema, it.krzeminski.snakeyaml.engine.kmp.schema.JsonSchema, it.krzeminski.snakeyaml.engine.kmp.schema.CoreSchema.

Link copied to clipboard

Constructors for the specified tags.

Link copied to clipboard
val useMarks: Boolean = true

Marks are only used for error messages, but they require a lot of memory. true by default. Use false to save resources but use less informative error messages (no line and context).

Link copied to clipboard

Manage YAML directive value which defines the version of the YAML specification. This parser supports YAML 1.2, but it can parse most of YAML 1.1 and YAML 1.0