]> source.dussan.org Git - jgit.git/commitdiff
AutoCRLFOutputStream: use BufferedOutputStream 77/195477/3
authorJörg Kubitz <jkubitz-eclipse@gmx.de>
Wed, 31 Aug 2022 15:02:54 +0000 (17:02 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 20 Sep 2022 08:00:17 +0000 (10:00 +0200)
This should improve performance of autocrlf checkout.

Bug: 580651
Change-Id: I2e2fe0273ac3c71fad50a575278234804ee28306

org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java

index e638b2de3a6f4c7c0f6d882064c75005c8832d05..305ccbd7e69cd0bcb970d6422b81d419c1b52d01 100644 (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 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;
        }