Вопрос

So I'm reading up on delta encoding, and I was looking around for some good examples of it. I think Google Chrome uses something like that for patch updates, rsync might, and the Wikipedia article implies that alot of online backup tools use this.

I'm curious if there are any good Java libraries out there that do this kind of work? There seem to be an abundance of *nix and C-based tools, but little or no Java equivalents that do much more than compress data structures.

In any event, this is an entirely new concept for me, so I'm curious to read up on anything about it, with a particular interest in seeing anyone using Java to do it.

Это было полезно?

Решение

Wikipedia lists several Java implementations for the VCDIFF delta format.

There also exist Java implementations of the rsync algorithm, which can be used to create binary diffs. They don't seem production-ready, but if you just want to see the code they're fine. See Any good rsync library for Java?.

Другие советы

I know this is an outrageously old question, but I decided to post this here just incase anyone else stumbles onto the same problem.

This is what I am currently using. It's really simple and works great.

https://code.google.com/p/xdeltaencoder/

You will need to make sure to checksum the source though (in my case fileAJson), as it does not do it automatically for you!

Anyways, code below:

//Create delta
String[] deltaArgs = new String[]{fileAJson.getAbsolutePath(), fileBJson.getAbsolutePath(), fileDelta.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);

//Apply delta
deltaArgs = new String[]{"-d", fileAJson.getAbsolutePath(), fileDelta.getAbsolutePath(), fileBTarget.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);

//Trivia, Surpisingly this also works
deltaArgs = new String[]{"-d", fileBJson.getAbsolutePath(), fileDelta.getAbsolutePath(), fileBTarget.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);

Update data only by difference between files (delta for java)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top