/vcdiff-java

An Java encoder/decoder for the VCDIFF (RFC3284) format

Primary LanguageJavaOtherNOASSERTION

Build Status Coverage Status Maven Central

VCDiff-java

A Java port of Google's open-vcdiff vcdiff (RFC3284) implementation. It's currently synced with open-vcdiff 0.8.4.

Download

Maven:

<dependency>
    <groupId>com.davidehrmann.vcdiff</groupId>
    <artifactId>vcdiff-core</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle:

compile 'com.davidehrmann.vcdiff:vcdiff-core:0.1.0'

Usage

Encoding (compressing)

byte[] dictionary = ...;
byte[] uncompressedData = ...;
OutputStream compressedData = ...;

// OutputStream (like GZIPOutputStream) and stream-based encoders are
// also available from the builder.
VCDiffEncoder<OutputStream> encoder = EncoderBuilder.builder()
    .withDictionary(dictionary)
    .buildSimple();

encoder.Encode(uncompressedData, compressedData);

Decoding (decompressing)

byte[] dictionary = ...;
byte[] compressedData = ...;
OutputStream uncompressedData = ...;

// InputStream (like GZIPInputStream) and stream-based decoders are
// also available from the builder.
VCDiffDecoder decoder = DecoderBuilder.builder().buildSimple();
decoder.Decode(dictionary, compressedData, uncompressedData);

Command line usage

The command line wrapper for java-vcdiff is generally compatble with the open-vcdiff implementation:

# Compress original with dictionary dict to compressed.vcdiff
java com.davidehrmann.vcdiff.VCDiffFileBasedCoder encode -dictionary dict -delta compressed.vcdiff -target original

# Decompress compressed.vcdiff with dictionary dict to decompressed
java com.davidehrmann.vcdiff.VCDiffFileBasedCoder decode -dictionary dict -delta compressed.vcdiff -target decompressed

# Usage details
java com.davidehrmann.vcdiff.VCDiffFileBasedCoder help

The command line tool is available in the Central Repository

Maven:

<dependency>
    <groupId>com.davidehrmann.vcdiff</groupId>
    <artifactId>vcdiff-cli</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle:

compile 'com.davidehrmann.vcdiff:vcdiff-cli:0.1.0'

See also