writeUTF method

void writeUTF(
  1. String value
)

Writes a UTF-8 string to the byte stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string.

Implementation

void writeUTF(String value) {
  List<int> utf8bytes = utf8.encode(value);
  int length = utf8bytes.length;
  writeShort(length);
  _setAll(_position, utf8bytes);
  _position += length;
}