예제 #1
0
 @Nonnull
 public static File mergeFiles(@Nonnull File... files) {
   if (files.length == 0) {
     throw new IllegalArgumentException("no files to merge");
   }
   File result = ObjectUtils.clone(files[0]);
   for (int index = 1; index < files.length; index++) {
     mergeFiles(result, files[index]);
   }
   return result;
 }
예제 #2
0
 /** pre-condition: mergeTo and beMerged are isostructural */
 private static void mergeDirectoryFiles(
     @Nonnull DirectoryFile mergeTo, @Nonnull DirectoryFile beMerged) {
   for (File file : beMerged.getChildren()) {
     final File fileInMergeTo = findFirst(mergeTo.getChildren(), file, ISOSTRUCTURAL_FILE);
     if (fileInMergeTo == null) {
       mergeTo.addChild(ObjectUtils.clone(file));
     } else {
       mergeFiles0(fileInMergeTo, file);
     }
   }
 }