TupleData constructor
TupleData(
- ByteDataReader reader,
- Encoding encoding
TupleData does not consume the entire bytes
It'll read until the types are generated.
Implementation
TupleData(ByteDataReader reader, Encoding encoding) {
columnNum = reader.readUint16();
for (var i = 0; i < columnNum; i++) {
// reading order matters
final dataType = reader.readUint8();
final tupleDataType = TupleDataType.fromByte(dataType);
late final int length;
late final Uint8List data;
switch (tupleDataType) {
case TupleDataType.textType:
case TupleDataType.binaryType:
length = reader.readUint32();
data = reader.read(length);
break;
case TupleDataType.nullType:
case TupleDataType.toastType:
length = 0;
data = Uint8List(0);
break;
}
columns.add(
TupleDataColumn(
dataType: dataType,
length: length,
data: encoding.decode(data),
),
);
}
}