开发者

how to convert binary string data into String in android

开发者 https://www.devze.com 2023-01-10 00:07 出处:网络
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.

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消