test_class.declarator: SIGNATURE = "ENDSLEY/BSDIFF43"
test_class.modifier: private static final
test_class.original_string: private static final String SIGNATURE = "ENDSLEY/BSDIFF43";
test_class.type: String
test_class.var_name: SIGNATURE
test_class.declarator: buffer1
test_class.modifier: private
test_class.original_string: private byte[] buffer1;
test_class.type: byte[]
test_class.var_name: buffer1
test_class.declarator: buffer2
test_class.modifier: private
test_class.original_string: private byte[] buffer2;
test_class.type: byte[]
test_class.var_name: buffer2
test_class.declarator: oldFile
test_class.modifier: private
test_class.original_string: private File oldFile;
test_class.type: File
test_class.var_name: oldFile
test_class.file: feya/libraries/archive_diff/diff.applier/src/test/java/com/google/archivepatcher/applier/bsdiff/BsPatchTest.java
test_class.identifier: BsPatchTest
test_case.body: @Test
    public void testApplyPatch_CopySegmentLengthTooLarge() throws Exception {
      createEmptyOldFile(10);
      InputStream patchIn =
          makePatch(
              SIGNATURE,
              10, // newLength
              0, // diffSegmentLength
              Integer.MAX_VALUE + 1, // copySegmentLength (too big)
              0, // offsetToNextInput
              new byte[10] // addends
              );
      ByteArrayOutputStream newData = new ByteArrayOutputStream();
      try {
        BsPatch.applyPatch(new RandomAccessFile(oldFile, "r"), newData, patchIn);
        Assert.fail("Read patch with excessive copySegmentLength");
      } catch (PatchFormatException expected) {
        // No way to mock the internal logic, so resort to testing exception string for coverage
        String actual = expected.getMessage();
        Assert.assertEquals("bad copySegmentLength", actual);
      }
    }
test_case.class_method_signature: BsPatchTest.testApplyPatch_CopySegmentLengthTooLarge()
test_case.full_signature: @Test public void testApplyPatch_CopySegmentLengthTooLarge()
test_case.identifier: testApplyPatch_CopySegmentLengthTooLarge
test_case.invocations: createEmptyOldFile makePatch applyPatch fail getMessage assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testApplyPatch_CopySegmentLengthTooLarge()
focal_class.declarator: SIGNATURE = "ENDSLEY/BSDIFF43"
focal_class.modifier: private static final
focal_class.original_string: private static final String SIGNATURE = "ENDSLEY/BSDIFF43";
focal_class.type: String
focal_class.var_name: SIGNATURE
focal_class.declarator: PATCH_BUFFER_SIZE = 1024 * 50
focal_class.modifier: private static final
focal_class.original_string: private static final int PATCH_BUFFER_SIZE = 1024 * 50;
focal_class.type: int
focal_class.var_name: PATCH_BUFFER_SIZE
focal_class.declarator: NEGATIVE_LONG_SIGN_MASK = 1L << 63
focal_class.modifier: private static final
focal_class.original_string: private static final long NEGATIVE_LONG_SIGN_MASK = 1L << 63;
focal_class.type: long
focal_class.var_name: NEGATIVE_LONG_SIGN_MASK
focal_class.declarator: PATCH_STREAM_BUFFER_SIZE = 4 * 1024
focal_class.modifier: private static final
focal_class.original_string: private static final int PATCH_STREAM_BUFFER_SIZE = 4 * 1024;
focal_class.type: int
focal_class.var_name: PATCH_STREAM_BUFFER_SIZE
focal_class.declarator: OUTPUT_STREAM_BUFFER_SIZE = 16 * 1024
focal_class.modifier: private static final
focal_class.original_string: private static final int OUTPUT_STREAM_BUFFER_SIZE = 16 * 1024;
focal_class.type: int
focal_class.var_name: OUTPUT_STREAM_BUFFER_SIZE
focal_class.file: feya/libraries/archive_diff/diff.applier/src/main/java/com/google/archivepatcher/applier/bsdiff/BsPatch.java
focal_class.identifier: BsPatch
focal_class.class_method_signature: BsPatch.applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_class.full_signature: public static void applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_class.identifier: applyPatch
focal_class.modifiers: public static
focal_class.parameters: (
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_class.return: void
focal_class.signature: void applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_class.class_method_signature: BsPatch.applyPatchInternal(
        final RandomAccessFile oldData,
        final OutputStream newData,
        final InputStream patchData)
focal_class.full_signature: private static void applyPatchInternal(
        final RandomAccessFile oldData,
        final OutputStream newData,
        final InputStream patchData)
focal_class.identifier: applyPatchInternal
focal_class.modifiers: private static
focal_class.parameters: (
        final RandomAccessFile oldData,
        final OutputStream newData,
        final InputStream patchData)
focal_class.return: void
focal_class.signature: void applyPatchInternal(
        final RandomAccessFile oldData,
        final OutputStream newData,
        final InputStream patchData)
focal_class.class_method_signature: BsPatch.transformBytes(
        final int diffLength,
        final InputStream patchData,
        final RandomAccessFile oldData,
        final OutputStream newData,
        final byte[] buffer1,
        final byte[] buffer2)
focal_class.full_signature: static void transformBytes(
        final int diffLength,
        final InputStream patchData,
        final RandomAccessFile oldData,
        final OutputStream newData,
        final byte[] buffer1,
        final byte[] buffer2)
focal_class.identifier: transformBytes
focal_class.modifiers: static
focal_class.parameters: (
        final int diffLength,
        final InputStream patchData,
        final RandomAccessFile oldData,
        final OutputStream newData,
        final byte[] buffer1,
        final byte[] buffer2)
focal_class.return: void
focal_class.signature: void transformBytes(
        final int diffLength,
        final InputStream patchData,
        final RandomAccessFile oldData,
        final OutputStream newData,
        final byte[] buffer1,
        final byte[] buffer2)
focal_class.class_method_signature: BsPatch.readBsdiffLong(InputStream in)
focal_class.full_signature: static final long readBsdiffLong(InputStream in)
focal_class.identifier: readBsdiffLong
focal_class.modifiers: static final
focal_class.parameters: (InputStream in)
focal_class.return: long
focal_class.signature: long readBsdiffLong(InputStream in)
focal_class.class_method_signature: BsPatch.readFully(
        final InputStream in, final byte[] destination, final int startAt, final int numBytes)
focal_class.full_signature: static void readFully(
        final InputStream in, final byte[] destination, final int startAt, final int numBytes)
focal_class.identifier: readFully
focal_class.modifiers: static
focal_class.parameters: (
        final InputStream in, final byte[] destination, final int startAt, final int numBytes)
focal_class.return: void
focal_class.signature: void readFully(
        final InputStream in, final byte[] destination, final int startAt, final int numBytes)
focal_class.class_method_signature: BsPatch.pipe(
        final InputStream in, final OutputStream out, final byte[] buffer, int copyLength)
focal_class.full_signature: static void pipe(
        final InputStream in, final OutputStream out, final byte[] buffer, int copyLength)
focal_class.identifier: pipe
focal_class.modifiers: static
focal_class.parameters: (
        final InputStream in, final OutputStream out, final byte[] buffer, int copyLength)
focal_class.return: void
focal_class.signature: void pipe(
        final InputStream in, final OutputStream out, final byte[] buffer, int copyLength)
focal_method.body: 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();
      }
    }
focal_method.class_method_signature: BsPatch.applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_method.full_signature: public static void applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_method.identifier: applyPatch
focal_method.invocations: applyPatchInternal flush
focal_method.modifiers: public static
focal_method.parameters: (
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)
focal_method.return: void
focal_method.signature: void applyPatch(
        RandomAccessFile oldData, OutputStream newData, InputStream patchData)