Module: Zipping::PKHeader
- Defined in:
- lib/zipping.rb
Class Method Summary collapse
-
.pk0102(dp) ⇒ Object
0102: central directory.
-
.pk0304(filetime, namelen, deflated, crc = nil, compsize = nil, uncompsize = nil) ⇒ Object
0304: header of entries.
-
.pk0506(entry_count, dirsize, offset) ⇒ Object
0506: end of central directory.
-
.pk0708(crc, compsize, uncompsize) ⇒ Object
0708: optional trailer of entries.
Class Method Details
.pk0102(dp) ⇒ Object
0102: central directory
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/zipping.rb', line 420 def self.pk0102(dp) # dp: info of an entry [ ZS_c_pk0102, ZS_c_ver_made, (dp[:deflated] ? ZS_c_ver_nocomp : ZS_c_ver_deflate), (dp[:deflated] ? ZS_c_opt_0708 : ZS_c_opt_none), (dp[:deflated] ? ZS_c_comp_deflate : ZS_c_comp_none), dp[:filetime].to_binary_dos_time, dp[:filetime].to_binary_dos_date, dp[:crc], dp[:complen], dp[:uncomplen], dp[:binary_name].length, ZS_c_int2_zero, ZS_c_int2_zero, ZS_c_int2_zero, ZS_c_int2_zero, (dp[:type] == :symlink ? ZS_c_oattr_symlink : dp[:type] == :dir ? ZS_c_oattr_dir : ZS_c_oattr_file), dp[:offset] ] end |
.pk0304(filetime, namelen, deflated, crc = nil, compsize = nil, uncompsize = nil) ⇒ Object
0304: header of entries
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/zipping.rb', line 444 def self.pk0304(filetime, namelen, deflated, crc = nil, compsize = nil, uncompsize = nil) [ ZS_c_pk0304, (deflated ? ZS_c_ver_deflate : ZS_c_ver_nocomp), (deflated ? ZS_c_opt_0708 : ZS_c_opt_none), (deflated ? ZS_c_comp_deflate : ZS_c_comp_none), filetime.to_binary_dos_time, filetime.to_binary_dos_date, (crc || ZS_c_int4_zero), (compsize || ZS_c_int4_zero), (uncompsize || ZS_c_int4_zero), namelen, ZS_c_int2_zero ] end |
.pk0506(entry_count, dirsize, offset) ⇒ Object
0506: end of central directory
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/zipping.rb', line 461 def self.pk0506(entry_count, dirsize, offset) # entry_count: count of entries in zip # dirsize: sum of central directory sizes # offset: byte offset of the first central directory [ ZS_c_pk0506, ZS_c_int2_zero, ZS_c_int2_zero, entry_count, entry_count, dirsize, offset, ZS_c_int2_zero ] end |
.pk0708(crc, compsize, uncompsize) ⇒ Object
0708: optional trailer of entries
478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/zipping.rb', line 478 def self.pk0708(crc, compsize, uncompsize) # crc: CRC32 for uncompressed data # compsize: size of compressed data # uncompsize: size of uncompressed data [ ZS_c_pk0708, crc, compsize, uncompsize ] end |