- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在通过 Windows 命名管道将( Protocol Buffer )序列化消息从 Java 应用程序发送到 .net C# 应用程序。
我已经为这两种环境编译了一个 .proto 文件。在 C# 端,我使用 protobuf-csharp-port。
我计划在流中使用长度前缀包。
在c#端读取messageLength后,我使用CodedInputStream.pushLimit(messageLength)。然后我想在这样的循环中使用 cis.getBytesUntilLimit() 检索实际消息:
do
{
builder.mergeFrom(cis);
} while (cis.getBytesUntilLimit() > 0);
但不幸的是,我在 protobuf-csharp-port 中找不到方法 getBytesUntilLimit()。
问题:protobuf-csharp-port中是否存在getBytesUntilLimit()? protobuf-csharp-port 是否忠实地在 .net 中实现了来自 Google 的所有 JAVA API(或至少是等效的)?
谢谢。
最佳答案
刚读了protobuf-csharp-port的源码,注意到一个属性ReachedLimit。我的问题的答案是:
do
{
builder.MergeFrom(cis);
} while (!cis.IsAtEnd);
关于c# - Protocol Buffer - protobuf-csharp-port : Does the equivalent of JAVA API call CodedInputStream. getBytesUntilLimit() 存在吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19183448/
我正在尝试实现与 java 版本兼容的 protobuf 发送/接收,它首先包含一个 varint32 前缀。 我几乎让它工作了,但由于某些原因,一些消息变得不完整并且无法通过 assert()。 /
这是演示该问题的示例代码。 ByteArrayOutputStream bos = new ByteArrayOutputStream(); CodedOutputStream cos
所以我有一个用于 hololens 的 dotNet CoreCLR 应用程序,据我了解,CoreCLR 不支持标准套接字,推荐的途径是使用 StreamSocket。 据我所知,CodedInput
val people = Person() people.mergeFrom(new FileInputStream("path_of_file")) Person是一个在scala中使用protob
在下面的代码中,我想在 C# 中使用预定义的 protobuf 消息。我发现我能够编写并使用该方法来获取已创建的方法并生成 byte[]: ContainerMessage containerMes
我在数据节点的日志中看到了这一点。这可能是因为我正在将 500 万个文件复制到 HDFS 中: java.lang.IllegalStateException: com.google.protobuf
我正在使用我最新项目中的 Protocol Buffer (proto3)。但是我遇到以下问题。从 python 生成的编码消息,我正在尝试从 Scala 解码它(我正在使用 SPARK)。您可以看到
我正在通过 Windows 命名管道将( Protocol Buffer )序列化消息从 Java 应用程序发送到 .net C# 应用程序。 我已经为这两种环境编译了一个 .proto 文件。在 C
我是一名优秀的程序员,十分优秀!