how to convert binary string data into String in android
Can anybody 开发者_运维知识库give me some clue that how to convert binary string into a string(english). I have tried and googled so much but couldn't find an answer.
Here is my code:
InputStream iStream = getApplicationContext().getResources().openRawResource(R.raw.map);
InputStreamReader input;
String line = "";
//char character[] = null;
//String res = "";
input = new InputStreamReader(iStream);
BufferedReader bf = new BufferedReader(input);
Log.i("Helloo i am above variable", "Variable");
try {
line = bf.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.i("hello helloo", line.toString());
Thanks in advance.
Have you tried the constructor InputStreamReader(InputStream in, Charset charset)
with Charset.forName("UTF-8")
as Charset
? However, if you try representing data which is other than a string, this won't give you any, except maybe something ugly or an error...
精彩评论