test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/bsdiff/BsDiffTest.java
test_class.identifier: BsDiffTest
test_case.body: @Test
    public void lengthOfMatchTest() throws IOException {
      String s1 =
          "this is a string that starts the same and has some sameness in the middle, but "
              + "ends differently";
      String s2 =
          "this is a string that starts the samish and has some sameness in the middle, but "
              + "then ends didlyiefferently";
      byte[] s1b = s1.getBytes(Charset.forName("US-ASCII"));
      byte[] s2b = s2.getBytes(Charset.forName("US-ASCII"));
      RandomAccessObject s1ro = new RandomAccessObject.RandomAccessByteArrayObject(s1b);
      RandomAccessObject s2ro = new RandomAccessObject.RandomAccessByteArrayObject(s2b);
  
      Assert.assertEquals(36, BsDiff.lengthOfMatch(s1ro, 0, s2ro, 0));
      Assert.assertEquals(0, BsDiff.lengthOfMatch(s1ro, 5, s2ro, 0));
      Assert.assertEquals(31, BsDiff.lengthOfMatch(s1ro, 5, s2ro, 5));
      Assert.assertEquals(42, BsDiff.lengthOfMatch(s1ro, 37, s2ro, 39));
      Assert.assertEquals(0, BsDiff.lengthOfMatch(s1ro, 38, s2ro, 39));
      Assert.assertEquals(32, BsDiff.lengthOfMatch(s1ro, 47, s2ro, 49));
      Assert.assertEquals(2, BsDiff.lengthOfMatch(s1ro, 90, s2ro, 83));
    }
test_case.class_method_signature: BsDiffTest.lengthOfMatchTest()
test_case.full_signature: @Test public void lengthOfMatchTest()
test_case.identifier: lengthOfMatchTest
test_case.invocations: getBytes forName getBytes forName assertEquals lengthOfMatch assertEquals lengthOfMatch assertEquals lengthOfMatch assertEquals lengthOfMatch assertEquals lengthOfMatch assertEquals lengthOfMatch assertEquals lengthOfMatch
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void lengthOfMatchTest()
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/bsdiff/BsDiff.java
focal_class.identifier: BsDiff
focal_class.class_method_signature: BsDiff.lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.full_signature: static int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.identifier: lengthOfMatch
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.return: int
focal_class.signature: int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.class_method_signature: BsDiff.searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.full_signature: static Match searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.identifier: searchForMatchBaseCase
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.return: Match
focal_class.signature: Match searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.class_method_signature: BsDiff.searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.full_signature: static Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.identifier: searchForMatch
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.return: Match
focal_class.signature: Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_method.body: static int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
        throws IOException {
      final int max = Math.min((int) oldData.length() - oldStart, (int) newData.length() - newStart);
      if (max > 0) {
        // If max is 0, it's sometimes possible for this seek to seek to length + 1 and throw an
        // exception unnecessarily.
        oldData.seek(oldStart);
        newData.seek(newStart);
        for (int offset = 0; offset < max; offset++) {
          if (oldData.readByte() != newData.readByte()) {
            return offset;
          }
        }
      }
  
      return max;
    }
focal_method.class_method_signature: BsDiff.lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_method.full_signature: static int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_method.identifier: lengthOfMatch
focal_method.invocations: min length length seek seek readByte readByte
focal_method.modifiers: static
focal_method.parameters: (
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_method.return: int
focal_method.signature: int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)