public final class UnifiedDiffUtils extends Object
Modifier and Type | Method and Description |
---|---|
static List<String> |
generateOriginalAndDiff(List<String> original,
List<String> revised)
Compare the differences between two files and return to the original file and diff format
(This method compares the original file with the comparison file to obtain a diff, and inserts the diff into the corresponding position of the original file.
|
static List<String> |
generateOriginalAndDiff(List<String> original,
List<String> revised,
String originalFileName,
String revisedFileName)
Compare the differences between two files and return to the original file and diff format
(This method compares the original file with the comparison file to obtain a diff, and inserts the diff into the corresponding position of the original file.
|
static List<String> |
generateUnifiedDiff(String originalFileName,
String revisedFileName,
List<String> originalLines,
Patch<String> patch,
int contextSize)
generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format
text representing the Patch.
|
static Patch<String> |
parseUnifiedDiff(List<String> diff)
Parse the given text in unified format and creates the list of deltas for it.
|
public static Patch<String> parseUnifiedDiff(List<String> diff)
diff
- the text in unified formatpublic static List<String> generateUnifiedDiff(String originalFileName, String revisedFileName, List<String> originalLines, Patch<String> patch, int contextSize)
originalFileName
- - Filename of the original (unrevised file)revisedFileName
- - Filename of the revised fileoriginalLines
- - Lines of the original filepatch
- - Patch created by the diff() functioncontextSize
- - number of lines of context output around each difference in the file.public static List<String> generateOriginalAndDiff(List<String> original, List<String> revised)
original
- Original file contentrevised
- revised file contentpublic static List<String> generateOriginalAndDiff(List<String> original, List<String> revised, String originalFileName, String revisedFileName)
original
- Original file contentrevised
- revised file contentoriginalFileName
- Original file namerevisedFileName
- revised file nameCopyright © 2009–2024 java-diff-utils. All rights reserved.