hasUtf32beBom function
Identifies whether a List of bytes starts (based on offset) with a big-endian byte-order marker (BOM).
Implementation
bool hasUtf32beBom(List<int> utf32EncodedBytes, [int offset = 0, int? length]) {
var end = length != null ? offset + length : utf32EncodedBytes.length;
return (offset + 4) <= end &&
utf32EncodedBytes[offset] == 0 &&
utf32EncodedBytes[offset + 1] == 0 &&
utf32EncodedBytes[offset + 2] == unicodeUtfBomHi &&
utf32EncodedBytes[offset + 3] == unicodeUtfBomLo;
}