checkWriteable method

bool checkWriteable(
  1. int index,
  2. int length
)

Checks the writability of the region while not taking buffer growth into account. Doesn't throw exceptions.

index < (index + length)

Implementation

bool checkWriteable(int index, int length) {
  if (index >= capacity()) return false;
  if (index + length - 1 >= capacity()) return false;
  return true;
}