KeyValue

open class KeyValue

Represents a recursive string key to arbitrary value container.

Constructors

Link copied to clipboard
constructor()
Initializes a new instance of the KeyValue class.
constructor(name: String)
Initializes a new instance of the KeyValue class.
constructor(name: String, value: String)
Initializes a new instance of the KeyValue class.

Types

Link copied to clipboard
enum Type

Properties

Link copied to clipboard
Link copied to clipboard
Represents an invalid KeyValue given when a searched for child does not exist.
Link copied to clipboard
open var name: String
Link copied to clipboard
open var value: String

Functions

Link copied to clipboard
open fun asBoolean(): Boolean
open fun asBoolean(defaultValue: Boolean): Boolean
Attempts to convert and return the value of this instance as a boolean.
Link copied to clipboard
open fun asByte(): Byte
open fun asByte(defaultValue: Byte): Byte
Attempts to convert and return the value of this instance as a byte.
Link copied to clipboard
open fun <T : Enum<T>?> asEnum(enumClass: Class<T>, defaultValue: T): EnumSet<T>
open fun <T : Enum<T>?> asEnum(enumClass: Class<T>, defaultValue: EnumSet<T>): EnumSet<T>
Attempts to convert and return the value of this instance as an enum.
Link copied to clipboard
open fun asFloat(): Float
open fun asFloat(defaultValue: Float): Float
Attempts to convert and return the value of this instance as a float.
Link copied to clipboard
open fun asInteger(): Int
open fun asInteger(defaultValue: Int): Int
Attempts to convert and return the value of this instance as an integer.
Link copied to clipboard
open fun asLong(): Long
open fun asLong(defaultValue: Long): Long
Attempts to convert and return the value of this instance as a long.
Link copied to clipboard
open fun asShort(): Short
open fun asShort(defaultValue: Short): Short
Attempts to convert and return the value of this instance as a short.
Link copied to clipboard
open fun asString(): String
Returns the value of this instance as a string.
Link copied to clipboard
open fun get(key: String): KeyValue
Gets the child KeyValue with the specified key.
Link copied to clipboard
open fun loadAsText(path: String): KeyValue
Attempts to load the given filename as a text KeyValue.
Link copied to clipboard
open fun loadFromString(input: String): KeyValue
Attempts to create an instance of KeyValue from the given input text.
Link copied to clipboard
Link copied to clipboard
open fun readFileAsText(filename: String): Boolean
Opens and reads the given filename as text.
Link copied to clipboard
open fun saveToFile(path: File, binary: Boolean)
Saves this instance to file.
Link copied to clipboard
open fun saveToStream(os: OutputStream, binary: Boolean)
Link copied to clipboard
open fun set(key: String, value: KeyValue)
Sets the child KeyValue with the specified key.
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
Attempts to load the given filename as a binary KeyValue.
Link copied to clipboard
Populate this instance from the given InputStream as a binary KeyValue.