From: Jörg Kubitz Date: Wed, 31 Aug 2022 15:02:54 +0000 (+0200) Subject: AutoCRLFOutputStream: use BufferedOutputStream X-Git-Tag: v6.4.0.202210260700-m2~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=eb5124c74f9bcdedc8492a8c1eddc734adfb7226;p=jgit.git AutoCRLFOutputStream: use BufferedOutputStream This should improve performance of autocrlf checkout. Bug: 580651 Change-Id: I2e2fe0273ac3c71fad50a575278234804ee28306 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java index e638b2de3a..305ccbd7e6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java @@ -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 class AutoCRLFOutputStream extends OutputStream { * @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; }