openStream function

RecordBatchStreamReader openStream(
  1. Uint8List bytes, {
  2. IpcLimits limits = const IpcLimits(),
})

Opens an in-memory Arrow IPC stream, like PyArrow's ipc.open_stream.

The schema message is decoded immediately. Malformed input raises FormatException; valid but unsupported input raises UnsupportedError.

Implementation

RecordBatchStreamReader openStream(
  Uint8List bytes, {
  IpcLimits limits = const IpcLimits(),
}) => _ipcGuard(() {
  final messages = _IpcMessageCursor(bytes, 0, limits);
  final first = messages.next();
  if (first == null || first.headerType != _ipcHeaderSchema) {
    throw const FormatException('IPC stream must begin with a Schema message');
  }
  return RecordBatchStreamReader._(
    _IpcReadState(_ipcReadSchema(first.header, limits), limits),
    messages,
  );
});