docs: protected int checkWrite(int offset, int length) {
      checkOffset(offset);
      if (limit == -1) {
        if (offset + length > capacity) {
          if (capacity < maxCapacity) {
            capacity(calculateCapacity(offset + length));
          } else {
            throw new BufferOverflowException();
          }
        }
      } else {
        if (offset + length > limit) {
          throw new BufferOverflowException();
        }
      }
      return offset(offset);
    }