• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Solution to deprecated getBytes

 
Roman Rytov
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic