test_class.declarator: unitTestZipArchive
test_class.modifier: private
test_class.original_string: private byte[] unitTestZipArchive;
test_class.type: byte[]
test_class.var_name: unitTestZipArchive
test_class.declarator: tempFile
test_class.modifier: private
test_class.original_string: private File tempFile;
test_class.type: File
test_class.var_name: tempFile
test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/MinimalZipArchiveTest.java
test_class.identifier: MinimalZipArchiveTest
test_case.body: @Test
    public void testListEntries() throws IOException {
      // Ensure all entries are found, and that they are in file order.
      List<MinimalZipEntry> parsedEntries = MinimalZipArchive.listEntries(tempFile);
      long lastSeenHeaderOffset = -1;
      for (int x = 0; x < UnitTestZipArchive.allEntriesInFileOrder.size(); x++) {
        UnitTestZipEntry expected = UnitTestZipArchive.allEntriesInFileOrder.get(x);
        MinimalZipEntry actual = parsedEntries.get(x);
        Assert.assertEquals(expected.path, actual.getFileName());
        Assert.assertEquals(expected.level == 0 ? 0 : 8, actual.getCompressionMethod());
        Assert.assertEquals(expected.getCompressedBinaryContent().length, actual.getCompressedSize());
        Assert.assertEquals(
            expected.getUncompressedBinaryContent().length, actual.getUncompressedSize());
        Assert.assertEquals(false, actual.getGeneralPurposeFlagBit11());
        CRC32 crc32 = new CRC32();
        crc32.update(expected.getUncompressedBinaryContent());
        Assert.assertEquals(crc32.getValue(), actual.getCrc32OfUncompressedData());
  
        // Offset verification is a little trickier
        // 1. Verify that the offsets are in ascending order and increasing.
        Assert.assertTrue(actual.getFileOffsetOfLocalEntry() > lastSeenHeaderOffset);
        lastSeenHeaderOffset = actual.getFileOffsetOfLocalEntry();
  
        // 2. Verify that the local signature header is at the calculated position
        byte[] expectedSignatureBlock = new byte[] {0x50, 0x4b, 0x03, 0x04};
        for (int index = 0; index < 4; index++) {
          byte actualByte = unitTestZipArchive[((int) actual.getFileOffsetOfLocalEntry()) + index];
          Assert.assertEquals(expectedSignatureBlock[index], actualByte);
        }
  
        // 3. Verify that the data is at the calculated position
        byte[] expectedContent = expected.getCompressedBinaryContent();
        int calculatedDataOffset = (int) actual.getFileOffsetOfCompressedData();
        for (int index = 0; index < expectedContent.length; index++) {
          Assert.assertEquals(
              expectedContent[index], unitTestZipArchive[calculatedDataOffset + index]);
        }
      }
    }
test_case.class_method_signature: MinimalZipArchiveTest.testListEntries()
test_case.full_signature: @Test public void testListEntries()
test_case.identifier: testListEntries
test_case.invocations: listEntries size get get assertEquals getFileName assertEquals getCompressionMethod assertEquals getCompressedBinaryContent getCompressedSize assertEquals getUncompressedBinaryContent getUncompressedSize assertEquals getGeneralPurposeFlagBit11 update getUncompressedBinaryContent assertEquals getValue getCrc32OfUncompressedData assertTrue getFileOffsetOfLocalEntry getFileOffsetOfLocalEntry getFileOffsetOfLocalEntry assertEquals getCompressedBinaryContent getFileOffsetOfCompressedData assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testListEntries()
focal_class.declarator: LOCAL_ENTRY_OFFSET_COMAPRATOR =
        new Comparator<MinimalZipEntry>() {
          @Override
          public int compare(MinimalZipEntry o1, MinimalZipEntry o2) {
            return Long.compare(o1.getFileOffsetOfLocalEntry(), o2.getFileOffsetOfLocalEntry());
          }
        }
focal_class.modifier: private static final
focal_class.original_string: private static final Comparator<MinimalZipEntry> LOCAL_ENTRY_OFFSET_COMAPRATOR =
        new Comparator<MinimalZipEntry>() {
          @Override
          public int compare(MinimalZipEntry o1, MinimalZipEntry o2) {
            return Long.compare(o1.getFileOffsetOfLocalEntry(), o2.getFileOffsetOfLocalEntry());
          }
        };
focal_class.type: Comparator<MinimalZipEntry>
focal_class.var_name: LOCAL_ENTRY_OFFSET_COMAPRATOR
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/MinimalZipArchive.java
focal_class.identifier: MinimalZipArchive
focal_class.class_method_signature: MinimalZipArchive.listEntries(File file)
focal_class.full_signature: public static List<MinimalZipEntry> listEntries(File file)
focal_class.identifier: listEntries
focal_class.modifiers: public static
focal_class.parameters: (File file)
focal_class.return: List<MinimalZipEntry>
focal_class.signature: List<MinimalZipEntry> listEntries(File file)
focal_class.class_method_signature: MinimalZipArchive.listEntriesInternal(RandomAccessFileInputStream in)
focal_class.full_signature: private static List<MinimalZipEntry> listEntriesInternal(RandomAccessFileInputStream in)
focal_class.identifier: listEntriesInternal
focal_class.modifiers: private static
focal_class.parameters: (RandomAccessFileInputStream in)
focal_class.return: List<MinimalZipEntry>
focal_class.signature: List<MinimalZipEntry> listEntriesInternal(RandomAccessFileInputStream in)
focal_method.body: public static List<MinimalZipEntry> listEntries(File file) throws IOException {
      try (RandomAccessFileInputStream in = new RandomAccessFileInputStream(file)) {
        return listEntriesInternal(in);
      }
    }
focal_method.class_method_signature: MinimalZipArchive.listEntries(File file)
focal_method.full_signature: public static List<MinimalZipEntry> listEntries(File file)
focal_method.identifier: listEntries
focal_method.invocations: listEntriesInternal
focal_method.modifiers: public static
focal_method.parameters: (File file)
focal_method.return: List<MinimalZipEntry>
focal_method.signature: List<MinimalZipEntry> listEntries(File file)