AutoCRLFOutputStream: use BufferedOutputStream

This should improve performance of autocrlf checkout.

Bug: 580651
Change-Id: I2e2fe0273ac3c71fad50a575278234804ee28306
This commit is contained in:
Jörg Kubitz 2022-08-31 17:02:54 +02:00 committed by Matthias Sohn
parent f71fcbf36b
commit eb5124c74f
1 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@
package org.eclipse.jgit.util.io;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -58,7 +59,9 @@ public AutoCRLFOutputStream(OutputStream out) {
* @since 4.3
*/
public AutoCRLFOutputStream(OutputStream out, boolean detectBinary) {
this.out = out;
// avoid to write single lines directly to FileOutputStream:
this.out = out instanceof BufferedOutputStream ? out
: new BufferedOutputStream(out);
this.detectBinary = detectBinary;
}