Comparer
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.ms.System.IDisposable, java.io.Closeable
public class Comparer implements System.IDisposable, Closeable
The Comparer class provides functionality for comparing documents and generating comparison results.
It allows you to compare various types of documents, such as PDF, Word, Excel, PowerPoint, and more.
Example usage:
try (Comparer comparer = new Comparer(sourceFile)) {
comparer.add(targetFile);
CompareOptions compareOptions = new CompareOptions();
compareOptions.setDetectStyleChanges(true);
comparer.compare(resultFile, compareOptions);
}
Constructors
Constructor | Description |
---|---|
Comparer(String filePath) | Initializes new instance of Comparer class with the specified source file path. |
Comparer(String filePath, CompareOptions compareOptions) | Initializes a new instance of the Comparer class with the specified folder path and compare options. |
Comparer(Path filePath) | Initializes new instance of Comparer class with the specified source file path. |
Comparer(String filePath, LoadOptions loadOptions) | Initializes new instance of Comparer with the specified source file path and LoadOptions. |
Comparer(Path filePath, LoadOptions loadOptions) | Initializes new instance of Comparer with the specified source file path and LoadOptions. |
Comparer(Path filePath, CompareOptions compareOptions) | Initializes new instance of Comparer with the specified source file path and LoadOptions. |
Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings) | Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings. |
Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions) | Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings. |
Comparer(String filePath, ComparerSettings settings) | Initializes new instance of Comparer class with the specified source file path and ComparerSettings. |
Comparer(Path filePath, ComparerSettings settings) | Initializes new instance of Comparer class with the specified source file path and ComparerSettings. |
Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings) | Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings. |
Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions) | Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings. |
Comparer(InputStream document) | Initializes new instance of Comparer class with the specified source document stream. |
Comparer(InputStream document, LoadOptions loadOptions) | Initializes new instance of Comparer with the specified source document stream and LoadOptions. |
Comparer(InputStream document, ComparerSettings settings) | Initializes new instance of Comparer class with the specified source document stream and ComparerSettings. |
Comparer(InputStream document, LoadOptions loadOptions, ComparerSettings settings) | Initializes new instance of Comparer class with the specified document stream, LoadOptions and ComparerSettings. |
Comparer(ComparerSettings settings) | Initializes new instance of Comparer class with the specified ComparerSettings. |
Fields
Field | Description |
---|---|
FILE_PATH |
Methods
Method | Description |
---|---|
getSource() | Gets the source document that is being compared. |
getTargets() | List of target documents to compare with source file. |
compare() | Compares the specified file with the target documents without saving result with default options. |
compare(String filePath) | Compares the specified file with the target documents and generates a comparison result. |
compare(Path filePath) | Compares the specified file with the target documents and generates a comparison result. |
compare(OutputStream outputStream) | Compares the specified file with the target documents and writes a comparison result to the output stream. |
compare(String filePath, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compare(Path filePath, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compare(OutputStream document, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the output stream. |
compare(SaveOptions saveOptions, CompareOptions compareOptions) | Compares the specified file with the target documents without saving result. |
compare(String filePath, SaveOptions saveOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compare(Path filePath, SaveOptions saveOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compare(OutputStream document, SaveOptions saveOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compare(CompareOptions compareOptions) | Compares the specified file with the target documents without saving result. |
compare(OutputStream outputStream, SaveOptions saveOptions, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the provided output stream. |
compare(String filePath, SaveOptions saveOptions, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
compareDirectory(String filePath, CompareOptions compareOptions) | Compares the specified directory with the target directory and saves the comparison result to the provided file path. |
compareDirectory(Path filePath, CompareOptions compareOptions) | Compares the specified directory with the target directory and saves the comparison result to the provided file path. |
compare(Path filePath, SaveOptions saveOptions, CompareOptions compareOptions) | Compares the specified file with the target documents and writes a comparison result to the provided file path. |
add(String filePath) | Adds the specified target document to the comparison process. |
add(String filePath, CompareOptions compareOptions) | Adds the specified target document or folder to the comparison process. |
add(Path filePath) | Adds the specified target document to the comparison process. |
add(String[] filePaths) | Adds the specified target documents to the comparison process. |
add(Path[] filePaths) | Adds the specified target documents to the comparison process. |
add(String filePath, LoadOptions loadOptions) | Adds the specified target document to the comparison process with loading options specified. |
add(Path filePath, LoadOptions loadOptions) | Adds the specified target document to the comparison process with loading options specified. |
add(Path filePath, CompareOptions compareOptions) | Adds the specified target document to the comparison process with loading options specified. |
add(InputStream document) | Adds the specified target document to the comparison process. |
add(InputStream[] documents) | Adds the specified target documents to the comparison process. |
add(InputStream document, LoadOptions loadOptions) | Adds the specified target document to the comparison process with loading options specified. |
getChanges() | Retrieves an array of ChangeInfo objects representing the changes detected during the comparison process. |
getChanges(GetChangeOptions getChangeOptions) | Retrieves an array of ChangeInfo objects representing the changes detected during the comparison process. |
applyChanges(String filePath, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to result document. |
applyChanges(Path filePath, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to resultant document. |
applyChanges(OutputStream document, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to resultant document. |
applyChanges(String filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to resultant document. |
applyChanges(Path filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to resultant document. |
applyChanges(OutputStream document, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions) | Accepts or rejects changes and applies them to resultant document. |
getResultString() | Gets result string after comparison (For Text Comparison only). |
getSourceFolder() | Returns the source folder that is being compared. |
getTargetFolder() | Returns the target folder that is being compared. |
close() | Releases resources. |
Comparer(String filePath)
public Comparer(String filePath)
Initializes new instance of Comparer class with the specified source file path.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document |
Comparer(String filePath, CompareOptions compareOptions)
public Comparer(String filePath, CompareOptions compareOptions)
Initializes a new instance of the Comparer class with the specified folder path and compare options.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document or folder |
compareOptions | CompareOptions | The compare options for folder comparison |
Comparer(Path filePath)
public Comparer(Path filePath)
Initializes new instance of Comparer class with the specified source file path.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document |
Comparer(String filePath, LoadOptions loadOptions)
public Comparer(String filePath, LoadOptions loadOptions)
Initializes new instance of Comparer with the specified source file path and LoadOptions.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document |
loadOptions | LoadOptions | The custom load options to be applied to the document |
Comparer(Path filePath, LoadOptions loadOptions)
public Comparer(Path filePath, LoadOptions loadOptions)
Initializes new instance of Comparer with the specified source file path and LoadOptions.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document |
loadOptions | LoadOptions | The custom load options to be applied to the document |
Comparer(Path filePath, CompareOptions compareOptions)
public Comparer(Path filePath, CompareOptions compareOptions)
Initializes new instance of Comparer with the specified source file path and LoadOptions.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document |
compareOptions | CompareOptions | The compare options for folder comparison |
Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings)
public Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings)
Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document |
loadOptions | LoadOptions | The custom load options to be applied to the document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions)
public Comparer(String filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions)
Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document or folder or text to be compared |
loadOptions | LoadOptions | The custom load options to be applied to the document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
compareOptions | CompareOptions | The compare options for folder comparison |
Comparer(String filePath, ComparerSettings settings)
public Comparer(String filePath, ComparerSettings settings)
Initializes new instance of Comparer class with the specified source file path and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the source document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(Path filePath, ComparerSettings settings)
public Comparer(Path filePath, ComparerSettings settings)
Initializes new instance of Comparer class with the specified source file path and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings)
public Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings)
Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document |
loadOptions | LoadOptions | The custom load options to be applied to the document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions)
public Comparer(Path filePath, LoadOptions loadOptions, ComparerSettings settings, CompareOptions compareOptions)
Initializes new instance of Comparer class with the specified source file path, LoadOptions and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the source document or folder |
loadOptions | LoadOptions | The custom load options to be applied to the document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
compareOptions | CompareOptions | The compare options for folder comparison |
Comparer(InputStream document)
public Comparer(InputStream document)
Initializes new instance of Comparer class with the specified source document stream.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The input stream of the source document |
Comparer(InputStream document, LoadOptions loadOptions)
public Comparer(InputStream document, LoadOptions loadOptions)
Initializes new instance of Comparer with the specified source document stream and LoadOptions.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The input stream of the source document |
loadOptions | LoadOptions | The custom load options to be applied to the document |
Comparer(InputStream document, ComparerSettings settings)
public Comparer(InputStream document, ComparerSettings settings)
Initializes new instance of Comparer class with the specified source document stream and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The input stream of the source document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(InputStream document, LoadOptions loadOptions, ComparerSettings settings)
public Comparer(InputStream document, LoadOptions loadOptions, ComparerSettings settings)
Initializes new instance of Comparer class with the specified document stream, LoadOptions and ComparerSettings.
- More about file types supported by GroupDocs.Comparison: Document formats supported by GroupDocs.Comparison
- More about GroupDocs.Comparison for Java features: Developer Guide
- More about how to open and compare password-protected documents: Open and compare password-protected documents
- More about how to open and compare document from URL, FTP, Amazon S3 and others: Open and compare documents from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The stream with data of a document to be compared |
loadOptions | LoadOptions | The custom load options to be applied to the document |
settings | ComparerSettings | The comparer settings to be used for the comparison process |
Comparer(ComparerSettings settings)
public Comparer(ComparerSettings settings)
Initializes new instance of Comparer class with the specified ComparerSettings.
Parameters:
Parameter | Type | Description |
---|---|---|
settings | ComparerSettings | the settings |
FILE_PATH
public static final String FILE_PATH
getSource()
public final Document getSource()
Gets the source document that is being compared.
Returns: Document - the source document
getTargets()
public final List<Document> getTargets()
List of target documents to compare with source file.
Returns: java.util.List<com.groupdocs.comparison.Document> - the target documents
compare()
public final Path compare()
Compares the specified file with the target documents without saving result with default options.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Returns: java.nio.file.Path - the path of result document or null
compare(String filePath)
public final Path compare(String filePath)
Compares the specified file with the target documents and generates a comparison result.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document path |
Returns: java.nio.file.Path - result file path or null. In some situations it’s extension can be changed
compare(Path filePath)
public final Path compare(Path filePath)
Compares the specified file with the target documents and generates a comparison result.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document path |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compare(OutputStream outputStream)
public final Path compare(OutputStream outputStream)
Compares the specified file with the target documents and writes a comparison result to the output stream.
Note: In cases when return value is null, use data that was written into outputStream
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
outputStream | java.io.OutputStream | Result document stream |
Returns: java.nio.file.Path - result file path or null when data from outputStream must be used. In some situations result file’s extension can be changed
compare(String filePath, CompareOptions compareOptions)
public final Path compare(String filePath, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparsion options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document file path |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compare(Path filePath, CompareOptions compareOptions)
public final Path compare(Path filePath, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparsion options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document file path |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compare(OutputStream document, CompareOptions compareOptions)
public final Path compare(OutputStream document, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the output stream.
Note: In case return value is null, use data that was written into outputStream.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparsion options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.OutputStream | Result document stream |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path or null when data from outputStream must be used. In some situations result file’s extension can be changed
compare(SaveOptions saveOptions, CompareOptions compareOptions)
public final Path compare(SaveOptions saveOptions, CompareOptions compareOptions)
Compares the specified file with the target documents without saving result.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparison options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
saveOptions | SaveOptions | Save options |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - the path of the result document or null
compare(String filePath, SaveOptions saveOptions)
public final Path compare(String filePath, SaveOptions saveOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document file path |
saveOptions | SaveOptions | Save options |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compare(Path filePath, SaveOptions saveOptions)
public final Path compare(Path filePath, SaveOptions saveOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document file path |
saveOptions | SaveOptions | Save options |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compare(OutputStream document, SaveOptions saveOptions)
public final Path compare(OutputStream document, SaveOptions saveOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
Note: In case return value is null, use data that was written into outputStream
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.OutputStream | Result document stream |
saveOptions | SaveOptions | Save options |
Returns: java.nio.file.Path - result file path or null when data from outputStream must be used. In some situations result file’s extension can be changed
compare(CompareOptions compareOptions)
public final Path compare(CompareOptions compareOptions)
Compares the specified file with the target documents without saving result.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
Parameters:
Parameter | Type | Description |
---|---|---|
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - the path to the result file or null
compare(OutputStream outputStream, SaveOptions saveOptions, CompareOptions compareOptions)
public final Path compare(OutputStream outputStream, SaveOptions saveOptions, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the provided output stream.
Note: In case return value is null, use data that was written into outputStream
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparsion options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
outputStream | java.io.OutputStream | Result document stream |
saveOptions | SaveOptions | The save options to be used for the saving the result document |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path or null when data from outputStream must be used. In some situations result file’s extension can be changed
compare(String filePath, SaveOptions saveOptions, CompareOptions compareOptions)
public final Path compare(String filePath, SaveOptions saveOptions, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparison options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document file path |
saveOptions | SaveOptions | The save options to be used for the saving the result document |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
compareDirectory(String filePath, CompareOptions compareOptions)
public void compareDirectory(String filePath, CompareOptions compareOptions)
Compares the specified directory with the target directory and saves the comparison result to the provided file path.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path where the comparison result will be saved. |
compareOptions | CompareOptions | The options to be used for the directory comparison process. |
compareDirectory(Path filePath, CompareOptions compareOptions)
public void compareDirectory(Path filePath, CompareOptions compareOptions)
Compares the specified directory with the target directory and saves the comparison result to the provided file path.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The file path where the comparison result will be saved. |
compareOptions | CompareOptions | The options to be used for the directory comparison process. |
compare(Path filePath, SaveOptions saveOptions, CompareOptions compareOptions)
public final Path compare(Path filePath, SaveOptions saveOptions, CompareOptions compareOptions)
Compares the specified file with the target documents and writes a comparison result to the provided file path.
- More about how to compare documents: How to compare documents in Java
- More about how to compare contracts, drafts and legal documents in Java: How to compare contracts, drafts and legal documents
- More about advanced comparsion options - accepting and rejecting detected changes, adjusting comparison sensitivity etc.: Advanced comparison options guide
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document file path |
saveOptions | SaveOptions | The save options to be used for the saving the result document |
compareOptions | CompareOptions | The compare options to be used for the comparison process |
Returns: java.nio.file.Path - result file path, in some situations it’s extension can be changed
add(String filePath)
public final void add(String filePath)
Adds the specified target document to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the target document to be added |
add(String filePath, CompareOptions compareOptions)
public void add(String filePath, CompareOptions compareOptions)
Adds the specified target document or folder to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the target document or folder to be added |
compareOptions | CompareOptions | The options for the comparison |
add(Path filePath)
public final void add(Path filePath)
Adds the specified target document to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the target document to be added |
add(String[] filePaths)
public final void add(String[] filePaths)
Adds the specified target documents to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
filePaths | java.lang.String[] | Paths to the target documents to be added |
add(Path[] filePaths)
public final void add(Path[] filePaths)
Adds the specified target documents to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
filePaths | java.nio.file.Path[] | Paths to the target documents to be added |
add(String filePath, LoadOptions loadOptions)
public final void add(String filePath, LoadOptions loadOptions)
Adds the specified target document to the comparison process with loading options specified.
- More about how to open and compare password-protected documents using GroupDocs.Comparison for Java: How to open and compare password-protected documents
- More about how to open and compare documents stored at local disk: How to open and compare files by file path
- More about how to open and compare documents from URL, FTP, Amazon S3 and other storages: How to open and compare files from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Path to the target document to be added |
loadOptions | LoadOptions | The custom load options to be applied to the document |
add(Path filePath, LoadOptions loadOptions)
public final void add(Path filePath, LoadOptions loadOptions)
Adds the specified target document to the comparison process with loading options specified.
- More about how to open and compare password-protected documents using GroupDocs.Comparison for Java: How to open and compare password-protected documents
- More about how to open and compare documents stored at local disk: How to open and compare files by file path
- More about how to open and compare documents from URL, FTP, Amazon S3 and other storages: How to open and compare files from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Path to the target document to be added |
loadOptions | LoadOptions | The custom load options to be applied to the document |
add(Path filePath, CompareOptions compareOptions)
public final void add(Path filePath, CompareOptions compareOptions)
Adds the specified target document to the comparison process with loading options specified.
- More about how to open and compare password-protected documents using GroupDocs.Comparison for Java: How to open and compare password-protected documents
- More about how to open and compare documents stored at local disk: How to open and compare files by file path
- More about how to open and compare documents from URL, FTP, Amazon S3 and other storages: How to open and compare files from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | The path to the target document or folder to be added |
compareOptions | CompareOptions | The options for the comparison |
add(InputStream document)
public final void add(InputStream document)
Adds the specified target document to the comparison process.
- More about how to open and compare password-protected documents using GroupDocs.Comparison for Java: How to open and compare password-protected documents
- More about how to open and compare documents stored at local disk: How to open and compare files by file path
- More about how to open and compare documents from URL, FTP, Amazon S3 and other storages: How to open and compare files from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The stream with data of a document to be compared |
add(InputStream[] documents)
public final void add(InputStream[] documents)
Adds the specified target documents to the comparison process.
Parameters:
Parameter | Type | Description |
---|---|---|
documents | java.io.InputStream[] | Streams with data of documents to be compared |
add(InputStream document, LoadOptions loadOptions)
public final void add(InputStream document, LoadOptions loadOptions)
Adds the specified target document to the comparison process with loading options specified.
- More about how to open and compare password-protected documents using GroupDocs.Comparison for Java: How to open and compare password-protected documents
- More about how to open and compare documents stored at local disk: How to open and compare files by file path
- More about how to open and compare documents from URL, FTP, Amazon S3 and other storages: How to open and compare files from third-party storages
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.InputStream | The stream with data of a document to be compared |
loadOptions | LoadOptions | The custom load options to be applied to the document |
getChanges()
public final ChangeInfo[] getChanges()
Retrieves an array of ChangeInfo objects representing the changes detected during the comparison process.
Use this method to get detailed information about the changes between the source document and the target document(s). Each ChangeInfo object contains information such as the type of change, the affected area, and the content before and after the change.
- More about how to obtain collection of detected differences between compared documents in Java: How to get list of changes between documents in Java
- More about how to get changes coordinates at pages image preview when comparing documents using GroupDocs.Comparison for Java: How to get changes coordinates programmatically
Returns: com.groupdocs.comparison.result.ChangeInfo[] - an array of ChangeInfo objects representing the changes detected during the comparison process
getChanges(GetChangeOptions getChangeOptions)
public final ChangeInfo[] getChanges(GetChangeOptions getChangeOptions)
Retrieves an array of ChangeInfo objects representing the changes detected during the comparison process.
Use this method to get detailed information about the changes between the source document and the target document(s). Each ChangeInfo object contains information such as the type of change, the affected area, and the content before and after the change.
Parameter GetChangeOptions allows to filter changes in different way.
- More about how to obtain collection of detected differences between compared documents in Java: How to get list of changes between documents in Java
- More about how to get changes coordinates at pages image preview when comparing documents using GroupDocs.Comparison for Java: How to get changes coordinates programmatically
Parameters:
Parameter | Type | Description |
---|---|---|
getChangeOptions | GetChangeOptions | The object that allows to filter changes |
Returns: com.groupdocs.comparison.result.ChangeInfo[] - an array of ChangeInfo objects representing the changes detected during the comparison process
applyChanges(String filePath, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(String filePath, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to result document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document file path |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
applyChanges(Path filePath, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(Path filePath, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to resultant document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document file path |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
applyChanges(OutputStream document, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(OutputStream document, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to resultant document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.OutputStream | Result document output stream |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
applyChanges(String filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(String filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to resultant document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | Result document file path |
saveOptions | SaveOptions | The save options to configure saving result document |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
applyChanges(Path filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(Path filePath, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to resultant document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.nio.file.Path | Result document file path |
saveOptions | SaveOptions | The save options to configure saving result document |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
applyChanges(OutputStream document, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
public final void applyChanges(OutputStream document, SaveOptions saveOptions, ApplyChangeOptions applyChangeOptions)
Accepts or rejects changes and applies them to resultant document.
- More about how apply or reject detected differences between compared documents in a resultant document: How to apply or reject changes detected during document comparison in Java
Parameters:
Parameter | Type | Description |
---|---|---|
document | java.io.OutputStream | Result document output stream |
saveOptions | SaveOptions | The save options to configure saving result document |
applyChangeOptions | ApplyChangeOptions | The custom apply change options to configure process of applying changes |
getResultString()
public String getResultString()
Gets result string after comparison (For Text Comparison only).
Returns: java.lang.String - the result string
getSourceFolder()
public String getSourceFolder()
Returns the source folder that is being compared.
Returns: java.lang.String - the source folder
getTargetFolder()
public String getTargetFolder()
Returns the target folder that is being compared.
Returns: java.lang.String - the target folder
close()
public void close()
Releases resources.