getString method

String getString(
  1. int length, [
  2. BufferEncoding encoding = BufferEncoding.utf8
])

Reads a region of the buffer as an encoded string.

Items are read from the range [offset : offset+length]. If length is omitted, the range extends to the end of the buffer.

The range must satisy the relations 0offsetoffset+lengththis.length.

Implementation

String getString(final int length,
    [final BufferEncoding encoding = BufferEncoding.utf8]) {
  final String value = buffer.getString(encoding, offset, length);
  offset += length;
  return value;
}