Utf32BytesDecoder constructor

Utf32BytesDecoder(
  1. List<int> utf32EncodedBytes, [
  2. int offset = 0,
  3. int? length,
  4. int replacementCodepoint = unicodeReplacementCharacterCodepoint,
])

create an Utf32BytesDecoder

Implementation

factory Utf32BytesDecoder(
  List<int> utf32EncodedBytes, [
  int offset = 0,
  int? length,
  int replacementCodepoint = unicodeReplacementCharacterCodepoint,
]) {
  length ??= utf32EncodedBytes.length - offset;
  if (hasUtf32beBom(utf32EncodedBytes, offset, length)) {
    return Utf32beBytesDecoder(
      utf32EncodedBytes,
      offset + 4,
      length - 4,
      false,
      replacementCodepoint,
    );
  } else if (hasUtf32leBom(utf32EncodedBytes, offset, length)) {
    return Utf32leBytesDecoder(
      utf32EncodedBytes,
      offset + 4,
      length - 4,
      false,
      replacementCodepoint,
    );
  } else {
    return Utf32beBytesDecoder(
      utf32EncodedBytes,
      offset,
      length,
      false,
      replacementCodepoint,
    );
  }
}