FileIOUtils { public static void merge(List<File> files, File output) throws IOException { mergeSortedFiles( files, output, lexComparator, true); } private  FileIOUtils(); static void sort(File file); static void sort(File file, Comparator<String> comparator); static void merge(List<File> files, File output); static void merge(List<File> files, File output, Comparator<String> comparator); static File copy(InputStream stream); static void append(List<File> files, File appendTo, boolean delete); static void writeAsLine(BufferedWriter writer, String str, boolean escape); static int writeStrings(Iterator<String> iterator, File f, boolean escape); static int writeStrings(Iterator<String> iterator, File f, boolean escape,
        @Nullable Logger logger, @Nullable String message); static int writeStrings(Iterator<String> iterator, File f, boolean escape,
        @NotNull java.util.function.Function<String, String> transformer, @Nullable Logger logger, @Nullable String message); @Deprecated static int writeStrings(Iterator<String> iterator, File f, boolean escape,
            @NotNull Function<String, String> transformer, @Nullable Logger logger, @Nullable String message); static Set<String> readStringsAsSet(InputStream stream, boolean unescape); static Comparator<String> lineBreakAwareComparator(Comparator<String> delegate); static void copyInputStreamToFile(final InputStream source, final File destination); final static Comparator<String> lexComparator; @Deprecated final static Function<String, String> passThruTransformer; }
@Test public void mergeWithErrorsTest() throws IOException { Set<String> added2 = newHashSet("2", "3", "5", "6"); File f2 = assertWrite(added2.iterator(), false, added2.size()); Set<String> added3 = newHashSet("t", "y", "8", "9"); File f3 = assertWrite(added3.iterator(), false, added3.size()); try { merge(newArrayList(f2, f3), null); } catch(Exception e) {} assertTrue(!f2.exists()); assertTrue(!f3.exists()); }