Interface FileComparison

All Superinterfaces:
Comparison, HistoryEntry
All Known Subinterfaces:
ImageComparison, TextComparison

public interface FileComparison extends Comparison
A Comparison of individual files - text or images. Adds the ability to save the files of the comparison, for example after a merge.

 const MergeOp = Java.type('com.deltawalker.script.MergeOp');
 const Role = Java.type('com.deltawalker.script.Role');

 // A three-way text comparison
 await comp.compare();
 await comp.merge(MergeOp.MERGE, comp.getAllDeltas(), null, Role.REF, null);
 comp.save(Role.REF, App.getProperty('user.home') + '/test/merged.txt', null);
 
Since:
2.0
  • Method Details

    • save

      void save(Role role, String path, ProgressListener pm) throws IOException
      Saves the file with the specified Role.
      Parameters:
      role - the Role of the file to save; cannot be null and must be a role of this comparison, for instance Role.TWO is not a role of a two-way comparison
      path - the path to save the file to. When null or an empty string, the file is saved to its current location.
      pm - reserved; pass null
      Throws:
      IOException - if the save operation fails
      NullPointerException - if role is null
      IllegalArgumentException - if path is null or empty and the file has no current location
      Since:
      2.0
    • saveAll

      void saveAll(ProgressListener pm) throws IOException
      Saves all files of this comparison to their current locations.
      Parameters:
      pm - reserved; pass null
      Throws:
      IOException - if the save operation fails
      Since:
      2.0
    • saveEx

      void saveEx(Role role, UriInfo uriInfo, ProgressListener pl) throws IOException
      Saves the file with the specified Role to the location described by the specified UriInfo, for example to a remote server or with a specific character encoding.
      Parameters:
      role - the Role of the file to save; cannot be null and must be a role of this comparison
      uriInfo - where and how to save the file. When null or when its URI is empty, the file is saved to its current location.
      pl - reserved; pass null
      Throws:
      IOException - if the save operation fails
      NullPointerException - if role is null
      IllegalArgumentException - if uriInfo is null or empty and the file has no current location
      Since:
      2.0