diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java index 62bfdd3f9da..77eae193dee 100644 --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java @@ -19,21 +19,20 @@ import static java.io.File.createTempFile; import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.commons.io.FileUtils.forceDelete; -import static org.apache.commons.io.IOUtils.closeQuietly; import static org.apache.commons.io.IOUtils.copyLarge; import static org.apache.jackrabbit.guava.common.io.Closeables.close; -import static org.apache.jackrabbit.guava.common.io.FileWriteMode.APPEND; -import static org.apache.jackrabbit.guava.common.io.Files.asByteSink; import static org.apache.jackrabbit.guava.common.io.Files.move; import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.escapeLineBreak; import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.unescapeLineBreaks; import static org.apache.jackrabbit.oak.commons.sort.ExternalSort.mergeSortedFiles; import static org.apache.jackrabbit.oak.commons.sort.ExternalSort.sortInBatch; +import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; @@ -146,14 +145,11 @@ public static void append(List files, File appendTo, boolean delete) throw boolean threw = true; try { - appendStream = asByteSink(appendTo, APPEND).openBufferedStream(); + appendStream = new BufferedOutputStream(new FileOutputStream(appendTo, true)); for (File f : files) { - InputStream iStream = new FileInputStream(f); - try { + try (InputStream iStream = new FileInputStream(f)) { copyLarge(iStream, appendStream); - } finally { - closeQuietly(iStream); } } threw = false;