-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to serialize byteSize() #58
Comments
I am not sure I understand the question. As it returns an |
What I'm trying to do is very simple. Suppose I have 2 messages:
I would like to write both messages to a protobuf file and then read them back in. My understanding is that you need to first write the length of the message and then the message. Then when you read it in you read the length and then the message. Here is an example of this idea in python: Based on that example I came up with the following script that works in limited cases:
I'm replacing the _VarintBytes from python by charToRaw(intToUtf8()). This seems to work as long the bytesize is less than 128 because starting at 128 it requires more symbols:
and it breaks. For example: |
I would look at the unit test files |
There are also the *Stream classes but I am not sure we have an example that serialize to file or connection based on a proto definition -- parts where always lacking because Google did not offer RPC support untol gRPC.io. You may need to cook something up based on the raw vectors. |
I see that RProtobuf has a function RProtoBuf::WriteVarint32. Are there any examples on how to use it? I think that is the equivalent in cpp to that python function _VarintBytes in the example. |
Hi
I'm trying to write multiple protobuf messages to a single file by including the byteSize() before serializing the message.
How do I properly write the byteSize to the file? In Python example I see that the byteSize is first converted to varint using the function _VarintBytes(). How do I convert the size in R?
thanks
FKG
The text was updated successfully, but these errors were encountered: