deserializePayload method

  1. @override
int deserializePayload(
  1. ReplayControlBuilder builder,
  2. ByteData byteData,
  3. Endian endianness,
  4. int offset,
)
override

Call to deserialize only the payload, no header. The Builder is to allow passing the message to build into. returns a int with a serialized size

Implementation

@override
int deserializePayload(imc.ReplayControlBuilder builder, ByteData byteData,
    Endian endianness, int offset) {
  var byteOffset = offset;

  // field op
  builder.op = imc.ReplayControlEnumOp(byteData.getUint8(byteOffset));
  byteOffset += 1;
  // field file
  var fileSSize = byteData.getUint16(byteOffset, endianness);
  byteOffset += 2;
  var fileDData = List.filled(fileSSize, 0);
  for (var i = 0; i < fileSSize; i++) {
    fileDData[i] = byteData.getUint8(byteOffset++);
  }
  var fileDecoded = utf8.decode(fileDData);
  builder.file = fileDecoded;

  return byteOffset - offset;
}