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.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/MinimalZipParserTest.java
test_class.identifier: MinimalZipParserTest
test_case.body: @Test
    public void testParseEocd() throws IOException {
      int eocdOffset = MinimalZipParser.locateStartOfEocd(unitTestZipArchive);
      ByteArrayInputStream in = new ByteArrayInputStream(unitTestZipArchive);
      Assert.assertEquals(eocdOffset, in.skip(eocdOffset));
      MinimalCentralDirectoryMetadata centralDirectoryMetadata = MinimalZipParser.parseEocd(in);
      Assert.assertNotNull(centralDirectoryMetadata);
  
      // Check that the central directory's first record is at the calculated offset
      //0x02014b50
      checkExpectedBytes(
          new byte[] {0x50, 0x4b, 0x01, 0x02},
          (int) centralDirectoryMetadata.getOffsetOfCentralDirectory());
      // Check that the central directory's length is correct, i.e. that the EOCD record follows it.
      long calculatedEndOfCentralDirectory =
          centralDirectoryMetadata.getOffsetOfCentralDirectory()
              + centralDirectoryMetadata.getLengthOfCentralDirectory();
      checkExpectedBytes(new byte[] {0x50, 0x4b, 0x05, 0x06}, (int) calculatedEndOfCentralDirectory);
      Assert.assertEquals(
          UnitTestZipArchive.allEntriesInFileOrder.size(),
          centralDirectoryMetadata.getNumEntriesInCentralDirectory());
    }
test_case.class_method_signature: MinimalZipParserTest.testParseEocd()
test_case.full_signature: @Test public void testParseEocd()
test_case.identifier: testParseEocd
test_case.invocations: locateStartOfEocd assertEquals skip parseEocd assertNotNull checkExpectedBytes getOffsetOfCentralDirectory getOffsetOfCentralDirectory getLengthOfCentralDirectory checkExpectedBytes assertEquals size getNumEntriesInCentralDirectory
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testParseEocd()
focal_class.declarator: EOCD_SIGNATURE = 0x06054b50
focal_class.modifier: public static final
focal_class.original_string: public static final int EOCD_SIGNATURE = 0x06054b50;
focal_class.type: int
focal_class.var_name: EOCD_SIGNATURE
focal_class.declarator: CENTRAL_DIRECTORY_ENTRY_SIGNATURE = 0x02014b50
focal_class.modifier: public static final
focal_class.original_string: public static final int CENTRAL_DIRECTORY_ENTRY_SIGNATURE = 0x02014b50;
focal_class.type: int
focal_class.var_name: CENTRAL_DIRECTORY_ENTRY_SIGNATURE
focal_class.declarator: LOCAL_ENTRY_SIGNATURE = 0x04034b50
focal_class.modifier: public static final
focal_class.original_string: public static final int LOCAL_ENTRY_SIGNATURE = 0x04034b50;
focal_class.type: int
focal_class.var_name: LOCAL_ENTRY_SIGNATURE
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/MinimalZipParser.java
focal_class.identifier: MinimalZipParser
focal_class.class_method_signature: MinimalZipParser.readByteOrDie(InputStream in)
focal_class.full_signature: private static int readByteOrDie(InputStream in)
focal_class.identifier: readByteOrDie
focal_class.modifiers: private static
focal_class.parameters: (InputStream in)
focal_class.return: int
focal_class.signature: int readByteOrDie(InputStream in)
focal_class.class_method_signature: MinimalZipParser.skipOrDie(InputStream in, long numBytes)
focal_class.full_signature: private static void skipOrDie(InputStream in, long numBytes)
focal_class.identifier: skipOrDie
focal_class.modifiers: private static
focal_class.parameters: (InputStream in, long numBytes)
focal_class.return: void
focal_class.signature: void skipOrDie(InputStream in, long numBytes)
focal_class.class_method_signature: MinimalZipParser.read16BitUnsigned(InputStream in)
focal_class.full_signature: private static int read16BitUnsigned(InputStream in)
focal_class.identifier: read16BitUnsigned
focal_class.modifiers: private static
focal_class.parameters: (InputStream in)
focal_class.return: int
focal_class.signature: int read16BitUnsigned(InputStream in)
focal_class.class_method_signature: MinimalZipParser.read32BitUnsigned(InputStream in)
focal_class.full_signature: private static long read32BitUnsigned(InputStream in)
focal_class.identifier: read32BitUnsigned
focal_class.modifiers: private static
focal_class.parameters: (InputStream in)
focal_class.return: long
focal_class.signature: long read32BitUnsigned(InputStream in)
focal_class.class_method_signature: MinimalZipParser.readOrDie(InputStream in, byte[] buffer, int offset, int length)
focal_class.full_signature: private static void readOrDie(InputStream in, byte[] buffer, int offset, int length)
focal_class.identifier: readOrDie
focal_class.modifiers: private static
focal_class.parameters: (InputStream in, byte[] buffer, int offset, int length)
focal_class.return: void
focal_class.signature: void readOrDie(InputStream in, byte[] buffer, int offset, int length)
focal_class.class_method_signature: MinimalZipParser.parseCentralDirectoryEntry(InputStream in)
focal_class.full_signature: public static MinimalZipEntry parseCentralDirectoryEntry(InputStream in)
focal_class.identifier: parseCentralDirectoryEntry
focal_class.modifiers: public static
focal_class.parameters: (InputStream in)
focal_class.return: MinimalZipEntry
focal_class.signature: MinimalZipEntry parseCentralDirectoryEntry(InputStream in)
focal_class.class_method_signature: MinimalZipParser.parseLocalEntryAndGetCompressedDataOffset(InputStream in)
focal_class.full_signature: public static long parseLocalEntryAndGetCompressedDataOffset(InputStream in)
focal_class.identifier: parseLocalEntryAndGetCompressedDataOffset
focal_class.modifiers: public static
focal_class.parameters: (InputStream in)
focal_class.return: long
focal_class.signature: long parseLocalEntryAndGetCompressedDataOffset(InputStream in)
focal_class.class_method_signature: MinimalZipParser.locateStartOfEocd(RandomAccessFileInputStream in, int searchBufferLength)
focal_class.full_signature: public static long locateStartOfEocd(RandomAccessFileInputStream in, int searchBufferLength)
focal_class.identifier: locateStartOfEocd
focal_class.modifiers: public static
focal_class.parameters: (RandomAccessFileInputStream in, int searchBufferLength)
focal_class.return: long
focal_class.signature: long locateStartOfEocd(RandomAccessFileInputStream in, int searchBufferLength)
focal_class.class_method_signature: MinimalZipParser.locateStartOfEocd(byte[] buffer)
focal_class.full_signature: public static int locateStartOfEocd(byte[] buffer)
focal_class.identifier: locateStartOfEocd
focal_class.modifiers: public static
focal_class.parameters: (byte[] buffer)
focal_class.return: int
focal_class.signature: int locateStartOfEocd(byte[] buffer)
focal_class.class_method_signature: MinimalZipParser.parseEocd(InputStream in)
focal_class.full_signature: public static MinimalCentralDirectoryMetadata parseEocd(InputStream in)
focal_class.identifier: parseEocd
focal_class.modifiers: public static
focal_class.parameters: (InputStream in)
focal_class.return: MinimalCentralDirectoryMetadata
focal_class.signature: MinimalCentralDirectoryMetadata parseEocd(InputStream in)
focal_method.body: public static MinimalCentralDirectoryMetadata parseEocd(InputStream in)
        throws IOException, ZipException {
      if (((int) read32BitUnsigned(in)) != EOCD_SIGNATURE) {
        throw new ZipException("Bad eocd header");
      }
  
      // *** 4 bytes encode EOCD_SIGNATURE, ignore (already found and verified).
      // 2 bytes encode disk number for this archive, ignore.
      // 2 bytes encode disk number for the central directory, ignore.
      // 2 bytes encode num entries in the central directory on this disk, ignore.
      // *** 2 bytes encode num entries in the central directory overall [READ THIS]
      // *** 4 bytes encode the length of the central directory [READ THIS]
      // *** 4 bytes encode the file offset of the central directory [READ THIS]
      // 2 bytes encode the length of the zip file comment, ignore.
      // Everything else from here to the EOF is the zip file comment, or junk. Ignore.
      skipOrDie(in, 2 + 2 + 2);
      int numEntriesInCentralDirectory = read16BitUnsigned(in);
      if (numEntriesInCentralDirectory == 0xffff) {
        // If 0xffff, this is a zip64 archive and this code doesn't handle that.
        throw new ZipException("No support for zip64");
      }
      long lengthOfCentralDirectory = read32BitUnsigned(in);
      long offsetOfCentralDirectory = read32BitUnsigned(in);
      return new MinimalCentralDirectoryMetadata(
          numEntriesInCentralDirectory, offsetOfCentralDirectory, lengthOfCentralDirectory);
    }
focal_method.class_method_signature: MinimalZipParser.parseEocd(InputStream in)
focal_method.full_signature: public static MinimalCentralDirectoryMetadata parseEocd(InputStream in)
focal_method.identifier: parseEocd
focal_method.invocations: read32BitUnsigned skipOrDie read16BitUnsigned read32BitUnsigned read32BitUnsigned
focal_method.modifiers: public static
focal_method.parameters: (InputStream in)
focal_method.return: MinimalCentralDirectoryMetadata
focal_method.signature: MinimalCentralDirectoryMetadata parseEocd(InputStream in)