public static Runnable reader() throws IOException {
Log.e("Communication", "reader");
din = new DataInputStream(sock.getInputStream());
brdr = new BufferedReader(new InputStreamReader(din), 300);
boolean done = false;
while (!done) {
try {
char[] buffer = new char[200];
int anzahlZeichen = brdr.read(buffer, 0, 200);
String nachricht = new String(buffer, 0, anzahlZeichen);
byte[] in = nachricht.getBytes("ISO-8859-1");
for (int counter = 0; counter < nachricht.length(); counter++) {
System.out.println(in);
}
if (nachricht != null)
answer();
System.out.println(nachricht);
} catch (IOException ioe) {
done = true;
}
}
return null;
}
我想将字符串转换nachricht
为字节 [] in
,但我不明白。有人可以帮忙吗?我只收到数字,没有单词或字母。也欢迎另一种方法。我得到的System.out.println(nachricht)
只有七次,[B@41c04778
但我应该得到01 02 03 04 05 06 07
。