gpt4 book ai didi

java - protobuf 中 ByteSize() 的等价物

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:08:26 35 4
gpt4 key购买 nike

Java 中的 protobuf 是否有等效的 ByteSize()?我试图在序列化之前获取 protobuf 的大小。

类似于:

Protobuf.Builder buffer = Protobuf.newBuilder(); 

我现在需要缓冲区的大小。知道如何获得它吗?

最佳答案

构建 Protocol Buffer ,并调用getSerializedSize() .

关于java - protobuf 中 ByteSize() 的等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31281134/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com