Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 什么是「;“磁盘”;在这种背景下,ZIP文件的结构是什么?_File_Zip_Disk_File Structure - Fatal编程技术网

File 什么是「;“磁盘”;在这种背景下,ZIP文件的结构是什么?

File 什么是「;“磁盘”;在这种背景下,ZIP文件的结构是什么?,file,zip,disk,file-structure,File,Zip,Disk,File Structure,我目前正在为自己开发一个小型库,用于压缩和解压缩ZIP文件。到目前为止,我没有任何重大问题,除了我不知道ZIP文件中的“磁盘”是什么以及如何计算磁盘数: 4.3.16中央目录记录的结尾: end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes <= What does "disk" mean here? number of the disk with

我目前正在为自己开发一个小型库,用于压缩和解压缩ZIP文件。到目前为止,我没有任何重大问题,除了我不知道ZIP文件中的“磁盘”是什么以及如何计算磁盘数:

4.3.16中央目录记录的结尾:

end of central dir signature    4 bytes  (0x06054b50)

number of this disk             2 bytes   <= What does "disk" mean here?

number of the disk with the
start of the central directory  2 bytes   <= What does "disk" mean here?

total number of entries in the
central directory on this disk  2 bytes   <= What does "disk" mean here?

total number of entries in
the central directory           2 bytes

size of the central directory   4 bytes

offset of start of central
directory with respect to
the starting disk number        4 bytes   <= What does "disk" mean here?

.ZIP file comment length        2 bytes

.ZIP file comment       (variable size)
中央目录签名结束4字节(0x06054b50)
该磁盘的数量2字节该术语指的是在拆分和生成ZIP文件的上下文中的软盘(请参阅您提供的第8.0章;重点是我的):

8.1.1跨越是将ZIP文件分割成多个部分的过程 多个可移动媒体。这种支持通常只有 已为DOS格式的软盘提供

如今,实现通常不再支持拆分和跨越(例如(请参见限制)或(请参见过程
finish\u zip()
),因为软盘甚至光盘已经过时。如果您对不支持拆分和跨越(最初)没有意见,可以按如下方式设置值:

number of this disk             2 bytes   <=  You only have one disk/file, so set it to 1.

number of the disk with the
start of the central directory  2 bytes   <=  You only have one disk/file, so set it to 1.

total number of entries in the
central directory on this disk  2 bytes   <=  Set it to the overall number of records.

offset of start of central
directory with respect to
the starting disk number        4 bytes   <=  Set this offset (in bytes) relative to
                                              the start of your archive.
该磁盘的数量2字节该术语指的是在拆分和跨越ZIP文件的上下文中的软盘(请参阅您提供的第8.0章;重点是我的):

8.1.1跨越是将ZIP文件分割成多个部分的过程 多个可移动媒体。这种支持通常只有 已为DOS格式的软盘提供

如今,实现通常不再支持拆分和跨越(例如(请参见限制)或(请参见过程
finish\u zip()
),因为软盘甚至光盘已经过时。如果您对不支持拆分和跨越(最初)没有意见,可以按如下方式设置值:

number of this disk             2 bytes   <=  You only have one disk/file, so set it to 1.

number of the disk with the
start of the central directory  2 bytes   <=  You only have one disk/file, so set it to 1.

total number of entries in the
central directory on this disk  2 bytes   <=  Set it to the overall number of records.

offset of start of central
directory with respect to
the starting disk number        4 bytes   <=  Set this offset (in bytes) relative to
                                              the start of your archive.

number of this disk 2 bytes“您只有一个磁盘/文件,所以将其设置为1。”我看到的所有实现都使用0作为磁盘号。不确定这是否重要;规范没有说明它是0索引还是1索引。@ZachB:我查看了我链接的一个实现。至少从1开始计算。但也许最好测试0或1是否正确。“您只有一个磁盘/文件,所以将其设置为1。”我见过的所有实现都使用0作为磁盘号。不确定这是否重要;规范没有说明它是0索引还是1索引。@ZachB:我查看了我链接的一个实现。至少从1开始计算。但也许最好测试0或1是否正确。