Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting bytes to string and vice versa

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see following write and read methods. When read the bytes and convert them to string, I don't see the same String that I wrote. I know its a basic file read question but how do I convert those bytes to same String as it was before I wrote it?

Thanks
Imad

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's some useful advice, not just for Android, but for Java in general: Never, ever, use "String.getBytes()" or "new String(byte[])" - always be explicit about encodings.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic