Binary delta patches for directories
Utilities and library for creating and applying binary patches to file system directories. It's based on Javaxdelta library - java implementation of xdelta binary diff algorithm. GDIFF format is used for patches.
It can be used to implement auto-updating for rich-client applications.
Delta-diff and delta-patch utilities are available:
Libraries are available in Maven cental.
- supports directories with arbitrary structure
- supports changed, added and deleted files
- directory patch includes human readable '.index' file
- streaming patch creation and applying
- fail-fast patch applying with hash sum checks
- pure java, tested on linux and windows
Directory patch creation
- takes two directories (to create delta between) and
IOFilterto include/exclude files
- creates ZIP file (or stream) with GDIFF deltas for all changed files and '.index' text file (with '.index_' prefix) with list of unchanged, added, updated and deleted files with SHA1 hash sums
Patches are applied in fail-fast mode, application will be aborted on first wrong hash-sum or IO error.
- takes directory to patch and patch file (or stream)
- reads '.index' file and using it for futher steps:
- checks hash sums for 'unchanged' files
- reads from stream 'added' files, puts them into directory checking hash sums
- check hash sums for 'updated' files
- reads '.gdiff' patches from stream, applies them, checks hash sums for applied files
- checks hash sums for 'deleted' files
- deletes 'deleted' files
Maven dependency (available in central repository):
<dependency> <groupId>com.alexkasko.delta</groupId> <artifactId>delta-diff</artifactId> <!--artifactId>delta-patch</artifactId--> <version>1.1.3</version> </dependency>
For patch file/stream creation you should use one of these methods:
new DirDeltaCreator().create(oldDirectory, newDirectory, patchFile); new DirDeltaCreator().create(oldDirectory, newDirectory, filesFilter, patchOutputStream);
For patch application (it will throw
IOException on hash-sum error):
new DirDeltaPatcher().patch(directory, patchFile); new DirDeltaPatcher().patch(directory, patchZipInputStream);
DirDeltaPatcher are thread-safe (stateless).
delta-patch programs (they will be put into
delta-updater/delta-xxx/target/delta-xxx-yyy-distr) can be used as
command line utilities.
java -jar delta-diff.jar dir1 dir2 -o patch.zip
java -jar delta-patch.jar dir patch.zip
How to build
All dependencies are in Maven Central. To build project run:
mvn clean install
Note: javaxdelta depends on GNU Trove 1.0.2 library which is released under the LGPL license.
This project is released under the MIT License (the same license is used by javaxdelta project).
- fix typos in error messages (#2)
- add support for case-sensivity flag (#1)
NullOutputStreamusage to support recent versions of Guava
- code and dependencies cleanup, maven central upload
- initial version