setLength method

  1. @override
void setLength(
  1. int length
)
override

Sets the length of this buffer. Increases internal bytes buffer capacity if needed.

Implementation

@override
void setLength(int length) {
  if (length < 0) {
    length = 0;
  } else if (length > _capacity) {
    ensureCapacity(length);
  }

  _length = length;
  if (_position > _length) {
    _position = _length;
  }
}