Forums Register Login

Solution to deprecated getBytes

+Pie Number of slices to send: Send
to change one of deprecated methods in the source I'd like to offer a solution:
instead of
space = description[i].getLength();
size = newData[i].length();
toCopy = (size <= space) ? size : space;
newData[i].getBytes(0, toCopy, buffer, offset);
offset += space;
I'm gonna use:
space = description[i].getLength();
size = newData[i].length();
byte[] tmpBuffer = newData[i].getBytes();
System.arraycopy(tmpBuffer, 0, buffer, offset, size);
offset += space;

what do u think about this way? Did I forget something?
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 646 times.
Similar Threads
getBytes() urgent ????????
getBytes() deprecated method.. Am I missing something ?
problem in getBytes()
deprecated getBytes question
modify method in Data Class
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:30:35.