return null;
}
// T-Mo-NL doesn't use multi-byte encoding, so encoded length = input length
int estimatedByteLength = str0.length();
FastByteArrayOutputStream baos = new FastByteArrayOutputStream(estimatedByteLength);
try {
int len = str0.length();
for (int i = 0; i < len; i++) {
int search = 0;
char c = str0.charAt(i);
// T-Mo-NL's one extended char is Euro mark, encoded as 0x80
if (c == EURO_MARK)
baos.write(TMO_EURO_BYTE);
else {
for (; search < CHAR_TABLE.length; search++) {
if (search == EXTENDED_ESCAPE) {
continue;
}
if (c == CHAR_TABLE[search]) {
baos.write(search);
break;
}
}
if (search == CHAR_TABLE.length) {
// A '?' character.
baos.write(0x3f);
}
}
}
} catch (IOException e) {
// should be an impossible error
throw new RuntimeException("Impossible error with FastByteArrayOutputStream: " + e.getMessage(), e);
}
return baos.toByteArray();
}