The PROTOC function builds a PROTO instance from a protobuf descriptor or protobuf syntax. The PROTO instance describes a set of Protocol Buffers messages.

A PROTO instance is needed to serialize and deserialize data to/from Protocol Buffers.

The input to the PROTOC function is a serialized protobuf FileDescriptorSet as produced by invoking the protoc command in the following way:

protoc --include_imports --descriptor_set_out=/path/to/FileDescriptorSet.file file.proto

or a STRING containing a textual description as described on the Protocol Buffers website.

The content of the produced FileDescriptorSet.file converted to a byte array will serve as the desc parameter in the call to PROTOC.



// // Loads the definition of the following .proto as produced by // protoc --include_imports --descriptor_set_out=out in.proto // // in.proto: // // syntax = "proto3"; // // message TestMessage { // int64 id = 1; // string comment = 2; // } // 'CkwKCXRzdC5wcm90byI3CgtUZXN0TWVzc2FnZRIOCgJpZBgBIAEoA1ICaWQSGAoHY29tbWVudBgCIAEoCVIHY29tbWVudGIGcHJvdG8z' B64-> PROTOC