3

Is there an open-source Java implementation of the VCDIFF binary diff format (decoder and encoder)?

There are xdelta and open-vcdiff, but those are both C libraries.

Alternatively, are the other formats/algorithms that one could use to generate diffs for binary files from Java?

Thilo
  • 257,207
  • 101
  • 511
  • 656

5 Answers5

4

You can generate binary diffs using badiff; the website is

http://badiff.org/

and it is available on maven central. It's BSD licensed, so friendly for both OSS and commercial. The algorithm used is a chunked version of the O(ND) diff described in this paper:

http://www.xmailserver.org/diff2.pdf

The diff format isn't particularly compatible with anything else, but it produces some really good and really small diffs.

The library is pretty fast; on my desktop machine it can generate a diff for two random 50MB input streams in 54 seconds. Hopefully that's fast enough; I think it's reasonably impressive since that's a comparison of two token streams of 50 million tokens each. badiff will take advantage of multiple CPU cores when computing diffs.

disclaimer: I'm the author of badiff, so of course I think it's cool. I'm always open to suggestions; things like being able to read/write "standard" binary diff formats sound like cool new features to add in upcoming releases.

esialb
  • 51
  • 1
3

I have a decoder for VCDIFF written in C#, which would probably be fairly straightforward to port to Java, if that's any help. It's part of MiscUtil but I don't think it relies on any other bits of MiscUtil (or only minimally, anyway).

Unfortunately I never got round to writing an encoder, which is obviously rather harder - and wasn't necessary in our case (where we needed to apply patches in .NET on a mobile device, but could create them however we wanted at the server).

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Actually, I am in a similar situation, so having just the decoder would probably work. I'll take a look at MiscUtil, thanks. – Thilo Jul 10 '09 at 07:29
3

I hava ported MiscUtil's vcdiff decoder to java. https://github.com/xiaxiaocao/jvcdiff update: now it also have a vcdiff encoder

Dong Liu
  • 43
  • 4
Hsiafan
  • 197
  • 1
  • 7
1

I have a Java port of open-vcdiff on Github. It's tested against open-vcdiff, but it's not used in production anywhere.

David Ehrmann
  • 7,366
  • 2
  • 31
  • 40
1

There is a java-port of xdelta: http://sourceforge.net/projects/javaxdelta/

But i can not say anything on its quality - i did not try it yet.

  • I think it does not do VCDIFF, but GDIFF, which is an older standard (and MUCH simpler). It does have both decoder and encoder, though. – Thilo Jul 16 '09 at 23:03
  • javaxdelta works fine, we are using it for directory diffs (with [this wrapper](https://github.com/alexkasko/delta-updater)) in production – alexkasko Oct 27 '12 at 12:03