The methods AI showed me are not working. However, one method mentioned by AI seems to be usable, but it is private:
private CodedOutputStream(byte[] buffer, int offset, int length)
So, how can I serialize a protobuf message into a preallocated byte array? The preallocated array is large enough.