日期:2014-05-20 浏览次数:20656 次
boolean flagCR = false; out = new BufferedOutputStream(out); do { if((r = in.read(buffer)) <= 0) break; int start = 0; for(int i = 0; i < r; i++) { int c = buffer[i]; if(c == 10 && !flagCR && i >= 1) { out.write(buffer, start, i - start); out.write(13); start = i; } flagCR = c == 13; } if(start < r) out.write(buffer, start, r - start); } while(true);
if((r = in.read(buffer)) <= 0) break;