ascii85 static method
Implementation
static Uint8List ascii85(Uint8List input) {
final List<int> out = <int>[];
final List<int> group = <int>[];
int index = 0;
if (input.length >= 2 && input[0] == 0x3C && input[1] == 0x7E) index = 2;
while (index < input.length) {
final int byte = input[index++];
if (byte == 0x7E) break;
if (byte <= 0x20 || byte == 0x0A || byte == 0x0D) continue;
if (byte == 0x7A && group.isEmpty) {
out.addAll(const <int>[0, 0, 0, 0]);
continue;
}
if (byte < 0x21 || byte > 0x75) continue;
group.add(byte - 0x21);
if (group.length == 5) {
_emit85(group, out, 4);
group.clear();
}
}
if (group.isNotEmpty) {
final int count = group.length - 1;
while (group.length < 5) {
group.add(84);
}
_emit85(group, out, count);
}
return Uint8List.fromList(out);
}