OkioSerializer


Known direct subclasses
PreferencesSerializer

Proto based serializer for Preferences.


The OkioSerializer determines the on-disk format and API for accessing it.

The type T MUST be immutable. Mutable types will result in broken DataStore functionality.

Summary

Public functions

suspend T

Unmarshal object from source.

Cmn
suspend Unit
writeTo(t: T, sink: BufferedSink)

Marshal object to a Sink.

Cmn

Public properties

T

Value to return if there is no data on disk.

Cmn

Public functions

readFrom

suspend fun readFrom(source: BufferedSource): T

Unmarshal object from source.

Parameters
source: BufferedSource

the BufferedSource with the data to deserialize

writeTo

suspend fun writeTo(t: T, sink: BufferedSink): Unit

Marshal object to a Sink.

Parameters
t: T

the data to write to output

sink: BufferedSink

the BufferedSink to serialize data to

Public properties

defaultValue

val defaultValue: T

Value to return if there is no data on disk.