Interface ProtoCodec<T>
public interface ProtoCodec<T>
Per-class encoder / decoder for a @ProtoMessage type. The
Codename One Maven plugin emits one <Type>ProtoCodec per
@ProtoMessage class at build time and registers it with
ProtoCodecs so gRPC clients can locate codecs for nested
message types by class without reflection.
Implementations must be stateless -- the same codec instance is shared across concurrent requests.
-
Method Summary
Modifier and TypeMethodDescriptionread(ProtoReader in) Reads a message frominand returns the populated instance.voidwrite(ProtoWriter out, T value) Writesvalue's populated fields tooutin the protobuf binary wire format.
-
Method Details
-
write
Writesvalue's populated fields tooutin the protobuf binary wire format. Does not write a length prefix; callers that need length-delimited framing (such as nested messages or gRPC payload framing) handle that one layer up.- Throws:
IOException
-
read
Reads a message frominand returns the populated instance.inis expected to be positioned at the start of the message body (no length prefix); callers wrap a slice when reading nested messages.- Throws:
IOException
-