We are about to switch to a new forum software. Until then we have removed the registration on this forum.
ArrayList<Byte> byteList;
...(inserting data into bytelist)...
byte[] data = byteList.toArray(new Byte[c1.byteList.size()]);
So basically I'm manipulating byte data in an array list, because it's easier to add or delete this way, then after manipulating data I tried to convert byte arraylist back to byte array...well that's the point when porcessing gives me the "cannot convert from Byte[] to byte[]" error. Anyone have any idea on this? Please help!
Answers
You provide the wrong type to toArray...
Beside, auto-unboxing doesn't work automatically on arrays. I fear you have to loop on the array list manually to fill your array.
Most direct inline conversion possible (as you already noticed) is to a Byte[]; which is a
byte
class wrapper type: :-@And as PhiLho already demonstrated, to get a real
byte[]
, we gotta copy each element to the other: 8-|Thanks so much guys!