Question:
Hi, Can some one tell me the method to do this. When I use CkByteData's getBytes() or getData() I am getting syntax error as these functions are not returning Java byte array
Isn't it byte array simply is byte[]
? Then use loop (for
) and assign each byte to a new byte[]
using getBytes()
.
I'm sorry for the difficulty.
Here's the correct solution:
CkByteData byteData = new CkByteData(); // Create a Java byte array with some bytes.. byte[] myData = "Any String you want".getBytes(); // Copy the bytes from the Java byte array into the CkByteData. byteData.appendByteArray(myData); // Copy the bytes from the CkByteData to a new Java byte array. byte[] myData2 = byteData.toByteArray();