Package kotlinx.serialization.protobuf

Protocol buffers serialization format implementation, mostly compliant to proto2 specification.

Types

Link copied to clipboard
sealed class ProtoBuf : BinaryFormat

Implements encoding and decoding classes to/from bytes using Proto2[https://developers.google.com/protocol-buffers/docs/proto] specification. It is typically used by constructing an application-specific instance, with configured specific behaviour and, if necessary, registered custom serializers (in SerializersModule provided by serializersModule constructor parameter).

Link copied to clipboard
class ProtoBufBuilder

Builder of the ProtoBuf instance provided by ProtoBuf factory function.

Link copied to clipboard

Represents a number format in protobuf encoding.

Link copied to clipboard
annotation class ProtoNumber(val number: Int)

Specifies protobuf field number (a unique number for a field in the protobuf message) assigned to a Kotlin property.

Link copied to clipboard
annotation class ProtoPacked

Instructs that a particular collection should be written as packed array

Link copied to clipboard
annotation class ProtoType(val type: ProtoIntegerType)

Instructs to use a particular ProtoIntegerType for a property of integer number type. Affect Byte, Short, Int, Long and Char properties and does not affect others.

Functions

Link copied to clipboard
fun ProtoBuf(from: ProtoBuf = ProtoBuf, builderAction: ProtoBufBuilder.() -> Unit): ProtoBuf

Creates an instance of ProtoBuf configured from the optionally given ProtoBuf instance and adjusted with builderAction.