• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is replace the deprecated method getBytes() in this way right ?

 
Zhou Can
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What i do is :
First change use Char array to get the values , then convert the Char array to a string , finally using String.getBytes() turn the String to byte array .
Codes here :
byte [] buffer = new byte[recordLen];
char [] chars = new char[recordLen];
chars[0] = (char)LIVE_RECORD;
...
newData[i].getChars(0, toCopy, chars, offset);
...
}
String temp = new String(chars);
buffer = temp.getBytes();
db.write(buffer);
Is my choice right ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic