Serializing dynamic array of root elements (C#)

54 views
Skip to first unread message

Vladimír Kružliak

unread,
Sep 9, 2016, 10:57:26 AM9/9/16
to FlatBuffers
Hello,

I have a business requirement to serialize unknown number of messages into file stream. I would like to use flatbuffers to serialize messages to byte array and append this array to file stream. Then process next message. At some point I want to read the file and sequentially deserialize them. 

Is there a way to do this using only flatbuffers api? Or do i need to introduce some kind of protocol?

Thank you for any advice,

Vladimir

Wouter van Oortmerssen

unread,
Sep 9, 2016, 2:09:11 PM9/9/16
to Vladimír Kružliak, FlatBuffers
There's no built-in way to do this with FlatBuffers yet.

I recommend simply pre-fixing each buffer with a 32bit length.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vladimír Kružliak

unread,
Sep 12, 2016, 3:21:27 AM9/12/16
to FlatBuffers
Thanks for quick reply, Wouter. 

Yes, that is an option I thought of as well. I just wanted to check, if flatbuffers can handle it with its own api. Anyway, thanks again.

Wouter van Oortmerssen

unread,
Oct 12, 2016, 5:46:37 PM10/12/16
to FlatBuffers
btw, added some functionality to make size pre-fixing part of FlatBuffers: https://github.com/google/flatbuffers/commit/486c048a0d5963f83f3a0d6957e4dde41602e2e7

Reply all
Reply to author
Forward
0 new messages