@Test public void testPipe_CopyZeroBytes() throws IOException { int dataLength = 0; ByteArrayInputStream in = new ByteArrayInputStream(new byte[dataLength]); ByteArrayOutputStream out = new ByteArrayOutputStream(); BsPatch.pipe(in, out, new byte[100], dataLength); int actualLength = out.toByteArray().length; Assert.assertEquals(0, actualLength); }
static void pipe( final InputStream in, final OutputStream out, final byte[] buffer, int copyLength) throws IOException { while (copyLength > 0) { int maxCopy = Math.min(buffer.length, copyLength); readFully(in, buffer, 0, maxCopy); out.write(buffer, 0, maxCopy); copyLength -= maxCopy; } }
BsPatch { static void pipe( final InputStream in, final OutputStream out, final byte[] buffer, int copyLength) throws IOException { while (copyLength > 0) { int maxCopy = Math.min(buffer.length, copyLength); readFully(in, buffer, 0, maxCopy); out.write(buffer, 0, maxCopy); copyLength -= maxCopy; } } }
BsPatch { static void pipe( final InputStream in, final OutputStream out, final byte[] buffer, int copyLength) throws IOException { while (copyLength > 0) { int maxCopy = Math.min(buffer.length, copyLength); readFully(in, buffer, 0, maxCopy); out.write(buffer, 0, maxCopy); copyLength -= maxCopy; } }  }
BsPatch { static void pipe( final InputStream in, final OutputStream out, final byte[] buffer, int copyLength) throws IOException { while (copyLength > 0) { int maxCopy = Math.min(buffer.length, copyLength); readFully(in, buffer, 0, maxCopy); out.write(buffer, 0, maxCopy); copyLength -= maxCopy; } }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData); }
BsPatch { static void pipe( final InputStream in, final OutputStream out, final byte[] buffer, int copyLength) throws IOException { while (copyLength > 0) { int maxCopy = Math.min(buffer.length, copyLength); readFully(in, buffer, 0, maxCopy); out.write(buffer, 0, maxCopy); copyLength -= maxCopy; } }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData);  }