Ejemplo n.º 1
0
 @Override
 public SendDataRequest decode(ProtoReader reader) throws IOException {
   Builder builder = new Builder();
   long token = reader.beginMessage();
   for (int tag; (tag = reader.nextTag()) != -1; ) {
     switch (tag) {
       case 1:
         builder.data(ProtoAdapter.BYTES.decode(reader));
         break;
       default:
         {
           FieldEncoding fieldEncoding = reader.peekFieldEncoding();
           Object value = fieldEncoding.rawProtoAdapter().decode(reader);
           builder.addUnknownField(tag, fieldEncoding, value);
         }
     }
   }
   reader.endMessage(token);
   return builder.build();
 }
Ejemplo n.º 2
0
 @Override
 public void encode(ProtoWriter writer, SendDataRequest value) throws IOException {
   if (value.data != null) ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data);
   writer.writeBytes(value.unknownFields());
 }
Ejemplo n.º 3
0
 @Override
 public int encodedSize(SendDataRequest value) {
   return (value.data != null ? ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data) : 0)
       + value.unknownFields().size();
 }