Package kotlinx.serialization.protobuf

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

Types

ProtoBuf
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).

ProtoBufBuilder
Link copied to clipboard
class ProtoBufBuilder

Builder of the ProtoBuf instance provided by ProtoBuf factory function.

ProtoIntegerType
Link copied to clipboard
enum ProtoIntegerType : Enum<ProtoIntegerType>

Represents a number format in protobuf encoding.

ProtoNumber
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.PROPERTY])
annotation class ProtoNumber(number: Int)

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

ProtoType
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.PROPERTY])
annotation class ProtoType(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

ProtoBuf
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.