[code="java"]
long count = 0;
String line = br.readLine();
while (line != null) {
if (count > length) {
break;
}
count += line.getBytes("UTF-8").length;
count += 1; // Add \r's length
System.out.println(Thread.currentThread() + " " + line);
System.out.println(" count:" + count);
line = br.readLine();
}
[/code]
用这样的方法来统计已读的字节数为什么输出的结果不对呢?具体的说count统计的数目比实际的要少,这是什么原因造成的?