Formatting merge conflicts one byte at a time is going to be very
slow when the final OutputStream is a FileOutputStream and the JVM
is making system calls for each byte output.
When outputting a range of bytes from a byte[] the bol (beginning
of line) value only depends on the value of the last byte written.
Other bytes in the array can be passed directly to the lower stream
for more efficient output.
Change-Id: I3415f9a390ee215210a17bb5bf39164d197e1348
out.write(val);
bol = (val == '\n');
}
+
+ @Override
+ public void write(byte[] buf, int pos, int cnt) throws IOException {
+ if (cnt > 0) {
+ out.write(buf, pos, cnt);
+ bol = (buf[pos + (cnt - 1)] == '\n');
+ }
+ }
}