at.spardat.xma.xdelta
Class JarDelta

java.lang.Object
  extended by at.spardat.xma.xdelta.JarDelta

public class JarDelta
extends Object

This class calculates the binary difference of two zip files by applying Delta to all files contained in both zip files. All these binary differences are stored in the output zip file. New files are simply copied to the output zip file. Additionally all files contained in the target zip file are listed in META-INF/file.list.

Use JarPatcher to apply the output zip file.

Author:
gruber

Constructor Summary
JarDelta()
           
 
Method Summary
 void computeDelta(ZipFile source, ZipFile target, ZipOutputStream output)
          Computes the binary differences of two zip files.
 boolean equal(byte[] source, byte[] target)
          Test if the content of two byte arrays is completly identical.
static void main(String[] args)
          Main method to make computeDelta(ZipFile, ZipFile, ZipOutputStream) available at the command line.
usage JarDelta source target output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarDelta

public JarDelta()
Method Detail

computeDelta

public void computeDelta(ZipFile source,
                         ZipFile target,
                         ZipOutputStream output)
                  throws IOException
Computes the binary differences of two zip files. For all files contained in source and target which are not equal, the binary difference is caluclated by using com.nothome.delta.Delta#computeDelta(com.nothome.delta.SeekableSource, InputStream, int, DiffWriter). If the files are equal, nothing is written to the output for them. Files contained only in target and files to small for Delta are copied to output. Files contained only in source are ignored. At last a list of all files contained in target is written to META-INF/file.list in output.

Parameters:
source - the original zip file
target - a modification of the original zip file
output - the zip file where the patches have to be written to
Throws:
IOException - if an error occures reading or writing any entry in a zip file

equal

public boolean equal(byte[] source,
                     byte[] target)
Test if the content of two byte arrays is completly identical.

Returns:
true if source and target contain the same bytes.

main

public static void main(String[] args)
                 throws IOException
Main method to make computeDelta(ZipFile, ZipFile, ZipOutputStream) available at the command line.
usage JarDelta source target output

Throws:
IOException


Copyright © 2003-2008. All Rights Reserved.