Google is committed to advancing racial equity for Black communities. See how.

Serializer

interface Serializer<T>
androidx.datastore.Serializer

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

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

TODO(b/151635324): consider changing InputStream to File.

Summary

Public methods
abstract T

Unmarshal object from stream.

abstract Unit
writeTo(t: T, output: OutputStream)

Marshal object to a stream.

Public methods

readFrom

abstract fun readFrom(input: InputStream): T

Unmarshal object from stream. This must be able to handle an empty input stream - which is passed in as a default value.

writeTo

abstract fun writeTo(
    t: T,
    output: OutputStream
): Unit

Marshal object to a stream.