java-diff-utils
java-diff-utils copied to clipboard
File format
Hello. Does the library only support txt files? Binary files not?
This library supports it all :).
Look into test DuffUtilsTest.testDiffIntegerList.
@Test
public void testDiffIntegerList() {
List<Integer> original = Arrays.asList(1, 2, 3, 4, 5);
List<Integer> revised = Arrays.asList(2, 3, 4, 6);
final Patch<Integer> patch = DiffUtils.diff(original, revised);
for (AbstractDelta<Integer> delta : patch.getDeltas()) {
System.out.println(delta);
}
assertEquals(2, patch.getDeltas().size());
assertEquals("[DeleteDelta, position: 0, lines: [1]]", patch.getDeltas().get(0).toString());
assertEquals("[ChangeDelta, position: 4, lines: [5] to [6]]", patch.getDeltas().get(1).toString());
}
here integers are processed. So you could read a file into a bytebuffer and process this data.