Skip to content

Commit

Permalink
OAK-11385: Remove usage of Guava Files.asByteSink (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
reschke authored Jan 13, 2025
1 parent f08aa28 commit b363d95
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -146,14 +145,11 @@ public static void append(List<File> 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;
Expand Down

0 comments on commit b363d95

Please sign in to comment.