Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load protocol buffer objects into a collection from a file

If I have a file with many protocol buffers messages saved in one after each other, how do I read that file back to a collection in Java?

like image 561
iCode Avatar asked Mar 07 '26 15:03

iCode


1 Answers

How did you delimit the protobuf messages?

If you just wrote them one after the other, without using writeDelimitedTo you can't read them back, it's just not a format that protocol buffers support.

If you did use writeDelimitedTo, I think you can figure out the corresponding parse method.

like image 82
Dmitri Avatar answered Mar 09 '26 04:03

Dmitri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!