kotlin serialization protobuf with netty

Netty 具备与protobuf相连的功能,使用步骤是

  1. 定制proto文件
  2. 使用protoc生成OuterClass文件
  3. 使用Netty的ProtobufDecoder和ProtobufEncoder进行编解码

Kotlinx Serialization中也具备protobuf的功能,使用步骤是

  1. 直接定制Message.kt文件
  2. 自定义MessageDecoder和MessageEncoder进行序列化和反序列化,更为方便
posted on 2024-09-30 16:11  流浪的夜空  阅读(47)  评论(0)    收藏  举报