This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting bytes to string and vice versa  RSS feed

 
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
Boost this thread!