import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
File parentFolder = of.getParentFile();
if (!fs.exists(parentFolder))
parentFolder.mkdirs();
- FileOutputStream fos = new FileOutputStream(of);
- try {
- new MergeFormatter().formatMerge(fos, result,
+ try (OutputStream os = new BufferedOutputStream(
+ new FileOutputStream(of))) {
+ new MergeFormatter().formatMerge(os, result,
Arrays.asList(commitNames), CHARACTER_ENCODING);
- } finally {
- fos.close();
}
return of;
}