readAndDeserialize

suspend fun <T> Path.readAndDeserialize(deserializer: KSerializer<T>, format: StringFormat = jsonForMachines): Outcome<T>

Reads the content of the specified Path and deserializes it to an object of type T.

Return

The deserialized object of type T.

Parameters

deserializer

The KSerializer to use for deserialization.

format

The StringFormat to use for decoding (default: jsonForMachines).

Throws

IOException

if reading the file fails.

SerializationException

if deserialization fails.


suspend fun <T> File.readAndDeserialize(deserializer: KSerializer<T>, format: StringFormat = jsonForMachines): Outcome<T>

Reads the content of the specified File and deserializes it to an object of type T.

Return

The deserialized object of type T.

Parameters

deserializer

The KSerializer to use for deserialization.

format

The StringFormat to use for decoding (default: jsonForMachines).

Throws

if reading the file fails.

SerializationException

if deserialization fails.