如何将BufferedReader
中read()
返回的整数转换为实际字符值并将其附加到字符串中?read()
返回表示所读取字符的整数。但是当我这样做时,它不会将实际字符附加到字符串中,而是将整数表示本身附加到字符串中。
int c;
String result = "";
while ((c = bufferedReader.read()) != -1) {
//Since c is an integer, how can I get the value read by incoming.read() from here?
response += c; //This appends the integer read from incoming.read() to the String. I wanted the character read, not the integer representation
}
我应该怎么做才能获得实际读取的数据?