loadSubContent static method

List<int> loadSubContent({
  1. required Iterator<int> iterator,
})

Implementation

static List<int> loadSubContent({required Iterator<int> iterator}) {
  var len = getContentLength(iterator: iterator);
  int int64MaxValue = double.maxFinite.toInt();

  if (len >= BigInt.from(int64MaxValue)) {
    return <int>[];
  }

  var byteArray = <int>[];

  for (var i = 0; i < len.toInt(); i++) {
    if (iterator.moveNext()) {
      int? n;
      try {
        n = iterator.current;
      } catch (e) {}
      if (n != null) {
        byteArray.add(n);
      }
    } else {
      throw ASN1OutOfBufferError();
    }
  }

  return byteArray;
}