SignatureException, IOException, InputException, NoSuchAlgorithmException {
System.out.println("Calculating the diff between the source file and previous signature");
BufferedInputStream newStream = new BufferedInputStream(newFile);
BufferedInputStream previousStream = new BufferedInputStream(previousSignature);
if (!compress) {
return new PatchComputer.PatchComputerInputStream(newStream, new SignatureTable(previousStream), "MD5", 102400);
} else {
InputStream patchStream = new PatchComputer.PatchComputerInputStream(newStream, new SignatureTable(previousStream), "MD5", 1024000);
return new XZCompressInputStream(patchStream, 2 * chunkSize);
}
}