I probably just messed up something in my proto file but I can't seem to call the toByteArray function.
Using Java and the proto file was compiled with protoc.
What I'm calling...
BaseMessage.builder = baseMessage = BaseMessage.newBuilder();
Acknowledgement.builder = acknowledgeMessage = Acknowledgement.newBuilder();
acknowledgeMessage.setOk(true);
baseMessage.setAcknowledgement(acknowledgeMessage);
baseMessage.build();
byte[] send = baseMessage.toByteArray();
And BaseMessage is declared as...
public static final class BaseMessage
extends com.google.protobuf.GeneratedMessage
implements BaseMessageOrBuilder {
Maybe I'm missing somthing...
BaseMessage is extending GeneratedMessage which inherits toByteArray() from AbstractMessageLite in which toByteArray is public... So I should be able to use it?
Yes you are, you probably meant:
baseMessage.build().toByteArray()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With