com.groupdocs.comparison

Class Comparer

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable


    public class Comparer
    extends Object
    implements com.aspose.ms.System.IDisposable

    Represents main class that controls the documents comparison process.

    • Constructor Detail

      • Comparer

        public Comparer(InputStream document)

        Initializes new instance of Comparer class with source document stream.

        Parameters:
        document - Source document stream
      • Comparer

        public Comparer(InputStream document,
                LoadOptions loadOptions)

        Initializes new instance of Comparer with source document stream and LoadOptions.

        Parameters:
        document - Source document stream
        loadOptions - Load options
      • Comparer

        public Comparer(String filePath)

        Initializes new instance of Comparer class with source file path.

        Parameters:
        filePath - File path
      • Comparer

        public Comparer(String filePath,
                LoadOptions loadOptions)

        Initializes new instance of Comparer with source file path and LoadOptions.

        Parameters:
        filePath - File path
        loadOptions - Load options
    • Method Detail

      • add

        public final void add(InputStream... documents)

        Adds document stream to comparison.

        Parameters:
        documents - Compared documents streams
      • add

        public final void add(InputStream document)

        Adds document stream to comparison.

        Parameters:
        document - Compared document stream
      • add

        public final void add(InputStream document,
               LoadOptions loadOptions)

        Adds document stream to comparison with loading options specified.

        Parameters:
        document - Compared document stream
        loadOptions - Load options
      • add

        public final void add(String... filePaths)

        Adds file to comparison.

        Parameters:
        filePaths - Compared files paths
      • add

        public final void add(String filePath)

        Adds file to comparison.

        Parameters:
        filePath - Compared file path
      • add

        public final void add(String filePath,
               LoadOptions loadOptions)

        Adds file to comparison with loading options specified.

        Parameters:
        filePath - Compared file path
        loadOptions - Load options
      • applyChanges

        public final void applyChanges(OutputStream document,
                        ApplyChangeOptions applyChangeOptions)

        Accepts or rejects changes and applies them to resultant document.

        Parameters:
        document - Result document
        applyChangeOptions - Apply change options
      • applyChanges

        public final void applyChanges(OutputStream document,
                        SaveOptions saveOptions,
                        ApplyChangeOptions applyChangeOptions)

        Accepts or rejects changes and applies them to resultant document.

        Parameters:
        document - Result document
        saveOptions - Save options
        applyChangeOptions - Apply change options
      • applyChanges

        public final void applyChanges(String filePath,
                        ApplyChangeOptions applyChangeOptions)

        Accepts or rejects changes and applies them to resultant document.

        Parameters:
        filePath - Result file path
        applyChangeOptions - Apply change options
      • applyChanges

        public final void applyChanges(String filePath,
                        SaveOptions saveOptions,
                        ApplyChangeOptions applyChangeOptions)

        Accepts or rejects changes and applies them to resultant document.

        Parameters:
        filePath - Result file path
        saveOptions - Save options
        applyChangeOptions - Apply change options
      • compare

        public final void compare()

        Compares documents without saving result with default options

      • compare

        public final void compare(CompareOptions compareOptions)

        Compares documents without saving result.

        Parameters:
        compareOptions - Compare options
      • compare

        public final void compare(OutputStream document)

        Compares documents and saves result to file stream

        Parameters:
        document - Result document stream
      • compare

        public final void compare(OutputStream document,
                   CompareOptions compareOptions)

        Compares documents and saves result to file stream

        Parameters:
        document - Result document stream
        compareOptions - Compare options
      • compare

        public final void compare(OutputStream document,
                   SaveOptions saveOptions)

        Compares documents and save result to file stream

        Parameters:
        document - Result document stream
        saveOptions - Save options
      • compare

        public final void compare(OutputStream document,
                   SaveOptions saveOptions,
                   CompareOptions compareOptions)

        Compares documents and saves result to a stream.

        Parameters:
        document - Result document stream
        saveOptions - Save options
        compareOptions - Compare options
      • compare

        public final void compare(SaveOptions saveOptions,
                   CompareOptions compareOptions)

        Compares documents without saving result.

        Parameters:
        saveOptions - Save options
        compareOptions - Compare options
      • compare

        public final void compare(String filePath)

        Compares documents and saves result to file path

        Parameters:
        filePath - Result document path
      • compare

        public final void compare(String filePath,
                   CompareOptions compareOptions)

        Compares documents and saves result to file path

        Parameters:
        filePath - Result document file path
        compareOptions - Compare options
      • compare

        public final void compare(String filePath,
                   SaveOptions saveOptions)

        Compares documents and save result to file path

        Parameters:
        filePath - Result document file path
        saveOptions - Save options
      • compare

        public final void compare(String filePath,
                   SaveOptions saveOptions,
                   CompareOptions compareOptions)

        Compares documents and saves result to file path

        Parameters:
        filePath - Result document file path
        saveOptions - Save options
        compareOptions - Compare options
      • dispose

        public final void dispose()

        Releases resources.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • getChanges

        public final ChangeInfo[] getChanges()

        Gets list of changes between source and target file(s).

        Returns:
        array of changes
      • getChanges

        public final ChangeInfo[] getChanges(GetChangeOptions getChangeOptions)

        Gets list of changes between source and target file(s).

        Parameters:
        getChangeOptions - Get change options
        Returns:
        array of changes
      • getSource

        public final Document getSource()

        Source file that is being compared.

      • getTargets

        public final List<Document> getTargets()

        List of target files to compare with source file.