Thilo
Thilo

Reputation: 262474

VCDIFF for Java or alternative binary diff formats

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?

Upvotes: 3

Views: 3380

Answers (5)

David Ehrmann
David Ehrmann

Reputation: 7576

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

Upvotes: 1

Hsiafan
Hsiafan

Reputation: 372

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

Upvotes: 3

esialb
esialb

Reputation: 51

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.

Upvotes: 4

Reputation:

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.

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1500075

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).

Upvotes: 3

Related Questions