public static EObject internal_name2native(EObject arg) {
if (arg.testAtom() != null) {
throw ERT.badarg(arg);
}
else if (arg.testBinary() != null) {
EBinary bin = arg.testBinary();
byte[] binbytes = bin.getByteArray();
byte[] outbytes = new byte[binbytes.length + 1];
System.arraycopy(binbytes, 0, outbytes, 0, binbytes.length);
outbytes[outbytes.length - 1] = 0x0;
return new EBinary(outbytes);
}
else {
ESeq input = arg.testSeq();
List<Byte> bytes = new ArrayList<Byte>();
byte[] out;
while (!input.isNil()) {
Integer el = input.head().testSmall().intValue();
bytes.add(el.byteValue());
input = input.tail();
}
out = new byte[bytes.size() + 1];
for (int i = 0; i < bytes.size(); ++i) {
out[i] = bytes.get(i);
}
out[out.length - 1] = 0x0;
return new EBinary(out);
}
}