Protocol Buffers Kotlin Core: Key Concepts and Usage in Java class libraries
syntax = "proto3";
package com.example;
message Student {
string name = 1;
int32 age = 2;
repeated string courses = 3;
}
protoc --java_out=. Student.proto
import com.example.Student;
Student student = Student.newBuilder()
.setAge(20)
.build();
byte[] serializedData = student.toByteArray();
Student deserializedStudent = Student.parseFrom(serializedData);