[英]Protocol Buffers - protobuf-csharp-port : Does the equivalent of JAVA API call CodedInputStream.getBytesUntilLimit() exist?
I am sending (protocol buffer) serialized messages from a java application to a .net c# application over a Windows named pipe. 我正在通过Windows命名管道从Java应用程序向.net c#应用程序发送(协议缓冲区)序列化消息。
I have compiled a .proto file for both environments. 我已经为两种环境编译了一个.proto文件。 On the c# side, I use protobuf-csharp-port.
在C#端,我使用protobuf-csharp-port。
I was planning to use length-prefixed packages over the stream. 我打算在流中使用带有长度前缀的包。
After reading the messageLength on the c# side, I use CodedInputStream.pushLimit(messageLength). 在c#端阅读messageLength之后,我使用CodedInputStream.pushLimit(messageLength)。 I then wanted to retrieve the actual message using cis.getBytesUntilLimit() in a loop like this:
然后,我想使用cis.getBytesUntilLimit()在这样的循环中检索实际消息:
do
{
builder.mergeFrom(cis);
} while (cis.getBytesUntilLimit() > 0);
But unfortunately I could not find the method getBytesUntilLimit() in protobuf-csharp-port. 但不幸的是,我在protobuf-csharp-port中找不到方法getBytesUntilLimit()。
Question: Does getBytesUntilLimit() exist in protobuf-csharp-port? 问题:protobuf-csharp-port中是否存在getBytesUntilLimit()? Does protobuf-csharp-port faithfully implement in .net all the JAVA API from Google (or at least the equivalent thereof)?
protobuf-csharp-port是否在.net中忠实地实现了Google的所有JAVA API(或至少等效的实现)?
Thank you. 谢谢。
Just read the source code of protobuf-csharp-port and noticed a property ReachedLimit. 只需阅读protobuf-csharp-port的源代码,就会注意到一个属性ReachedLimit。 The answer to my question is:
我的问题的答案是:
do
{
builder.MergeFrom(cis);
} while (!cis.IsAtEnd);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.