刚投到
c一个
char。
另外,不要使用过
+=一个
String在一个循环。它是O(n ^
2),而不是预期的O(n)。使用
StringBuilder或
StringBuffer代替。
int c;StringBuilder response= new StringBuilder();while ((c = bufferedReader.read()) != -1) { // Since c is an integer, cast it to a char. // If c isn't -1, it will be in the correct range of char. response.append( (char)c ) ; }String result = response.toString();


