@Test public void testApplyPatch_ExpectedFinalOldDataOffset_PastEOF() throws Exception { createEmptyOldFile(10); InputStream patchIn = makePatch( SIGNATURE, 10, 10, 0, 1, new byte[10] ); ByteArrayOutputStream newData = new ByteArrayOutputStream(); try { BsPatch.applyPatch(new RandomAccessFile(oldFile, "r"), newData, patchIn); Assert.fail("Read patch with that moves past EOF in old file"); } catch (PatchFormatException expected) { String actual = expected.getMessage(); Assert.assertEquals("expectedFinalOldDataOffset too large", actual); } }
public static void applyPatch( RandomAccessFile oldData, OutputStream newData, InputStream patchData) throws PatchFormatException, IOException { patchData = new BufferedInputStream(patchData, PATCH_STREAM_BUFFER_SIZE); newData = new BufferedOutputStream(newData, OUTPUT_STREAM_BUFFER_SIZE); try { applyPatchInternal(oldData, newData, patchData); } finally { newData.flush(); } }
BsPatch { public static void applyPatch( RandomAccessFile oldData, OutputStream newData, InputStream patchData) throws PatchFormatException, IOException { patchData = new BufferedInputStream(patchData, PATCH_STREAM_BUFFER_SIZE); newData = new BufferedOutputStream(newData, OUTPUT_STREAM_BUFFER_SIZE); try { applyPatchInternal(oldData, newData, patchData); } finally { newData.flush(); } } }
BsPatch { public static void applyPatch( RandomAccessFile oldData, OutputStream newData, InputStream patchData) throws PatchFormatException, IOException { patchData = new BufferedInputStream(patchData, PATCH_STREAM_BUFFER_SIZE); newData = new BufferedOutputStream(newData, OUTPUT_STREAM_BUFFER_SIZE); try { applyPatchInternal(oldData, newData, patchData); } finally { newData.flush(); } }  }
BsPatch { public static void applyPatch( RandomAccessFile oldData, OutputStream newData, InputStream patchData) throws PatchFormatException, IOException { patchData = new BufferedInputStream(patchData, PATCH_STREAM_BUFFER_SIZE); newData = new BufferedOutputStream(newData, OUTPUT_STREAM_BUFFER_SIZE); try { applyPatchInternal(oldData, newData, patchData); } finally { newData.flush(); } }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData); }
BsPatch { public static void applyPatch( RandomAccessFile oldData, OutputStream newData, InputStream patchData) throws PatchFormatException, IOException { patchData = new BufferedInputStream(patchData, PATCH_STREAM_BUFFER_SIZE); newData = new BufferedOutputStream(newData, OUTPUT_STREAM_BUFFER_SIZE); try { applyPatchInternal(oldData, newData, patchData); } finally { newData.flush(); } }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData);  }