try {
rest = charlist.collectCharList(collector, rest);
} catch (CharCollector.InvalidElementException e) {
throw ERT.badarg(charlist, encodingSpec);
} catch (CharCollector.CollectingException e) {
EObject data = output_converter.convert(out);
return ETuple.make(ERROR_ATOM, data, e.restOfInput);
} catch (IOException e) {
throw new Error(e); // Not supposed to happen.
}
try {
collector.end();
if (rest != ERT.NIL) {
return ETuple.make(INCOMPLETE_ATOM,
output_converter.convert(out),
ErlConvert.iolist_to_binary(rest.reverse()));
}
} catch (CharCollector.PartialDecodingException e) {
EObject data = output_converter.convert(out);
return ETuple.make(INCOMPLETE_ATOM, data);
} catch (IOException e) {
throw new Error(e); // Not supposed to happen.
}