readNextBatch method
Decodes the next record batch, or returns null at end of stream.
Implementation
RecordBatch? readNextBatch() => _ipcGuard(() {
while (!_done) {
final message = _messages.next();
if (message == null) {
_done = true;
break;
}
switch (message.headerType) {
case _ipcHeaderDictionaryBatch:
_state.acceptDictionary(message, _budget, allowReplacement: true);
case _ipcHeaderRecordBatch:
if (++_batches > limits.maxBatches) {
throw const FormatException('Too many record batches');
}
return _state.decodeBatch(message, _budget);
case _ipcHeaderSchema:
throw const FormatException('Unexpected second Schema message');
default:
throw UnsupportedError(
'Unsupported IPC message type ${message.headerType}',
);
}
}
return null;
});