Sunday, 21 August 2016

File Delta / Versioning in Java


Delta encoding is a way of storing or transmitting data in the form of differences (deltas) between sequential data rather than complete files; more generally this is known as data differencing.
The differences are recorded in discrete files called "deltas" or "diffs". In situations where differences are small – for example, the change of a few words in a large document or the change of a few records in a large table – delta encoding greatly reduces data redundancy. Collections of unique deltas are substantially more space-efficient than their non-encoded equivalents.
VCDiff and Gdiff are the common format used for data encoding.
Xdelta is a library that helps to compare differences and make patch files. It also has lot more features like compare folders, apply patches etc..
The Java libary for creating and patching delta is Javaxdelta (http://javaxdelta.sourceforge.net/)
Javaxdelta library provides classes for generating binary (and also text diffs) in GDIFF format and patching binary and text streams.
Find it on maven repo : 

<dependency>

     <groupId>com.nothome</groupId>

     <artifactId>javaxdelta</artifactId>

     <version>2.0.0</version>

</dependency>

Also you can find a much useful wrapper for javaxdelta here : https://github.com/alexkasko/delta-updater
The other library with can be used is Badiff (http://badiff.org/wiki/Badiff)
Badiff is a pure-java byte-level diffing library for working with large inputs, taking advantage of parallel processing during optimization. badiff is pretty fast. badiff has no external dependencies, but requires Java 1.6 or higher. badiff is released under a BSD license.
Find it on maven repo :


<dependency>

     <groupId>org.badiff</groupId>

     <artifactId>badiff</artifactId>

     <version>1.2.0</version>

</dependency>





No comments:

Post a Comment