此方法沒有返回有效的字符串。可能是什麼原因?存儲在字符串
static BufferedWriter writer = null;
static int maxlines = 100;
public static String getTrimmedResponse(BufferedReader b)
{
try {
int count = 0;
writer = new BufferedWriter(new StringWriter());
for (String line; (line = b.readLine()) != null;) {
if (count++ % maxlines == 0)
line = line.replaceAll("\\n", "");
String trimmedLine = line.trim();
if (trimmedLine.charAt(trimmedLine.length() - 1) == '>')
writer.append(trimmedLine);
else
writer.write(line);
writer.newLine();
}
} catch (IOException e) {
e.printStackTrace();
Log.i("texception", e+"");
}
return writer.toString();
}
這將是很難讓你的縮進和代碼塊更加混淆。 – Bathsheba