readString method
Implementation
@override
String readString([String? label]) {
int length = readUint32();
int end = _readIndex + length;
StringBuffer stringBuffer = StringBuffer();
while (_readIndex < end) {
int c1 = readUint8();
if (c1 < 128) {
stringBuffer.writeCharCode(c1);
} else if (c1 > 191 && c1 < 224) {
int c2 = readUint8();
stringBuffer.writeCharCode((c1 & 31) << 6 | c2 & 63);
} else if (c1 > 239 && c1 < 365) {
int c2 = readUint8();
int c3 = readUint8();
int c4 = readUint8();
int u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) -
0x10000;
stringBuffer.writeCharCode(0xD800 + (u >> 10));
stringBuffer.writeCharCode(0xDC00 + (u & 1023));
} else {
int c2 = readUint8();
int c3 = readUint8();
stringBuffer.writeCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
}
}
return stringBuffer.toString();
}