DataDescriptor.php 616 B

1234567891011121314151617181920212223242526
  1. <?php
  2. declare(strict_types=1);
  3. namespace ZipStream;
  4. /**
  5. * @internal
  6. */
  7. abstract class DataDescriptor
  8. {
  9. private const SIGNATURE = 0x08074b50;
  10. public static function generate(
  11. int $crc32UncompressedData,
  12. int $compressedSize,
  13. int $uncompressedSize,
  14. ): string {
  15. return PackField::pack(
  16. new PackField(format: 'V', value: self::SIGNATURE),
  17. new PackField(format: 'V', value: $crc32UncompressedData),
  18. new PackField(format: 'V', value: $compressedSize),
  19. new PackField(format: 'V', value: $uncompressedSize),
  20. );
  21. }
  22. }