Converts the UTF-8 codeUnits
(a list of unsigned 8-bit integers) to the
corresponding string.
Uses the code units from start
to, but no including, end
.
If end
is omitted, it defaults to codeUnits.length
.
If the codeUnits
start with a leading UNICODE_BOM_CHARACTER_RUNE this
character is discarded.
Source
String convert(List<int> codeUnits, [int start = 0, int end]) {
// Allow the implementation to intercept and specialize based on the type
// of codeUnits.
String result = _convertIntercepted(_allowMalformed, codeUnits, start, end);
if (result != null) {
return result;
}
int length = codeUnits.length;
RangeError.checkValidRange(start, end, length);
if (end == null) end = length;
StringBuffer buffer = new StringBuffer();
_Utf8Decoder decoder = new _Utf8Decoder(buffer, _allowMalformed);
decoder.convert(codeUnits, start, end);
decoder.close();
return buffer.toString();
}