claimBytes method

int claimBytes (int size, int nextOutOfLineDepth)

Implementation

int claimBytes(int size, int nextOutOfLineDepth) {
  if (nextOutOfLineDepth > _maxOutOfLineDepth) {
    throw FidlError('Exceeded maxOutOfLineDepth',
        FidlErrorCode.fidlExceededMaxOutOfLineDepth);
  }
  final int result = _nextOffset;
  _nextOffset += align(size);
  if (_nextOffset > data.lengthInBytes) {
    throw FidlError(
        'Cannot access out of range memory', FidlErrorCode.fidlTooFewBytes);
  }
  return result;
}