Exemple #1
0
 /** Encode using regular protobuf delimited field writes */
 @Override
 public void writeTo(ByteBuffer bb) {
   VarIntUtil.writeVarInt32(bb, values.size());
   for (Value v : values) {
     byte[] b = ValueUtility.toGbp(v).toByteArray();
     VarIntUtil.writeVarInt32(bb, b.length);
     bb.put(b);
   }
 }
Exemple #2
0
 /** Decode using regular protobuf delimited field writes */
 private void parse(ByteBuffer bb) throws DecodingException {
   int num = VarIntUtil.readVarInt32(bb);
   for (int i = 0; i < num; i++) {
     int size = VarIntUtil.readVarInt32(bb);
     byte[] b = new byte[size];
     bb.get(b);
     try {
       Value v = ValueUtility.fromGpb(org.yamcs.protobuf.Yamcs.Value.parseFrom(b));
       values.add(v);
     } catch (InvalidProtocolBufferException e) {
       throw new DecodingException("Failed to decode Value: ", e);
     }
   }
 }