decodeUtf16Be method
Produce a String from a sequence of UTF-16BE encoded bytes. This method
strips a leading BOM by default, but can be overridden by setting the
optional parameter stripBom to false. Set the replacementCodepoint to
null to throw an ArgumentError rather than replace the bad value.
The default value for the replacementCodepoint is U+FFFD.
Implementation
String decodeUtf16Be(
List<int> input, [
int start = 0,
int? end,
bool stripBom = true,
int replacementCodepoint = unicodeReplacementCharacterCodepoint,
]) {
var codeunits = Utf16beBytesToCodeUnitsDecoder(
input,
start,
end == null ? input.length : end - start,
stripBom,
replacementCodepoint,
).decodeRest();
return String.fromCharCodes(
utf16CodeUnitsToCodepoints(codeunits, 0, null, replacementCodepoint)
.whereType<int>());
}