HI all
i am trying to construct a bytebuffer from byte array
after that when i print the byte buffer it is giving additional junk to original data
here i n the below code when i try to print "srcbuf" some times it gives additional junk data
can u please find out the error in the code
this is my code taken from dev guide
ByteBuffer srcBuf;
ByteBuffer destBuf;
// Declares an array of byte values
byte pArray[] = {'A','B','C','D','E','F','G','H','I','J'};
// Initializes the source array with a capacity of ten elements.
srcBuf.Construct(10);
// Copies the ten values from pArray starting at position 0 to the srcBuf
// Now, srcBuf's position = 10
srcBuf.SetArray(pArray, 0, 10);
// Flips the buffer: The limit is set to the current position and
// then the position is set to zero
srcBuf.Flip(); // srcBuf's position = 0 and limit = 10
AppLog("2 is %s ",srcBuf.GetPointer());
destBuf.Construct(20);
// Copies from the srcBuf to the destBuf
// Now, srcBuf's position = 10, the destBuf's position = 10
destBuf.CopyFrom(srcBuf);
destBuf.Flip();
AppLog("destbuff is %s ",destBuf.GetPointer());
ByteBuffer dbuff;
dbuff.Construct(16);
byte a[5];
destBuf.SetPosition(0);
destBuf.GetArray(a,0,5);
dbuff.SetArray(a,0,5);
dbuff.Flip();
AppLog("dbuff is %s",dbuff.GetPointer());
AppLog("dbuff getlimit is %d",dbuff.GetLimit());
AppLog("destbuff getlimit is %d",destBuf.GetLimit());
AppLog("sbuff getlimit is %d",srcBuf.GetLimit());