readString method Null safety
- [int? len]
Read a null-terminated string, or if len
is provided, that number of
bytes returned as a string.
Implementation
String readString([int? len]) {
if (len == null) {
final codes = <int>[];
while (!isEOS) {
final c = readByte();
if (c == 0) {
return String.fromCharCodes(codes);
}
codes.add(c);
}
throw ArchiveException('EOF reached without finding string terminator');
}
return String.fromCharCodes(readBytes(len));
}