RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(file, "r");
RandomAccessFileSeekableSource source = new RandomAccessFileSeekableSource(raf);
out = new BufferedOutputStream(new FileOutputStream(patched));
new GDiffPatcher().patch(source, patch, out);
} finally {
IOUtils.closeQuietly(out);
IOUtils.closeQuietly(raf);
}
}