readTable method
Implementation
ArrowTable readTable() => _guard(() {
final footer = _readFooter(bytes);
final footerLength = ByteData.sublistView(bytes)
.getInt32(bytes.length - 10, Endian.little);
if (footerLength > limits.maxMessageBytes) {
throw const FormatException('IPC footer exceeds maxMessageBytes');
}
final data = Uint8List.sublistView(
bytes,
0,
bytes.length - 10 - footerLength,
);
final schemaTable = footer.table(1);
if (schemaTable == null) {
throw const FormatException('IPC file footer has no schema');
}
final state = _ReadState(_decodeSchema(schemaTable, limits), limits);
for (final block in _blocks(footer, 2, limits.maxDictionaries)) {
final message = _readBlock(data, block, limits);
if (message.headerType != _headerDictionaryBatch) {
throw const FormatException('Dictionary block has wrong message type');
}
state.accept(message, allowReplacement: false);
}
for (final block in _blocks(footer, 3, limits.maxBatches)) {
final message = _readBlock(data, block, limits);
if (message.headerType != _headerRecordBatch) {
throw const FormatException(
'Record batch block has wrong message type',
);
}
state.accept(message, allowReplacement: false);
}
return state.table();
});