user3551798
user3551798

Reputation: 13

Split protobuf message to multiple output buffers

How can i split a protocol buffers message to multiple output buffers?

E.g. the ByteSize of the message is 20 and i have only a buffer of 10 bytes. I want to write half of the message to this buffer, transfer it, and write the second half of the message to the buffer and transfer it.

Upvotes: 1

Views: 1020

Answers (1)

Alan Stokes
Alan Stokes

Reputation: 18964

You need to implement the ZeroCopyOutputStream interface; you can re-use a single fixed-size buffer, just writing the contents whenever Next is called. (You have to handle Backup too, for the final buffer.)

Upvotes: 2

Related Questions