PreferencesSerializer


public static class PreferencesSerializer implements OkioSerializer


Proto based serializer for Preferences. Can be used to manually create DataStore using the DataStoreFactory#create function.

Summary

Public methods

@NonNull Preferences

Value to return if there is no data on disk.

@NonNull Preferences

Unmarshal object from source.

void

Marshal object to a Sink.

Public fields

INSTANCE

Added in 1.1.1
public @NonNull PreferencesSerializer INSTANCE

Public methods

getDefaultValue

Added in 1.1.1
public @NonNull Preferences getDefaultValue()

Value to return if there is no data on disk.

readFrom

public @NonNull Preferences readFrom(@NonNull BufferedSource source)

Unmarshal object from source.

Parameters
@NonNull BufferedSource source

the BufferedSource with the data to deserialize

writeTo

Added in 1.1.1
public void writeTo(@NonNull Preferences t, @NonNull BufferedSink sink)

Marshal object to a Sink.

Parameters
@NonNull Preferences t

the data to write to output

@NonNull BufferedSink sink

the BufferedSink to serialize data to