焦油。Z文件格式,结构,标题。

时间:2022-06-01 20:31:02

I am trying to figure out the file layout of tar.Z file. (so called .taz file. compressed tar file).

我在试着找出焦油的文件布局。Z文件。(所谓的.taz文件。压缩的tar文件)。

this file can be produced with tar -Z option or using unix compress utility(result are same)

此文件可以使用tar -Z选项或unix压缩实用程序生成(结果相同)

I tried to google some document about this file structure but there is no documentation about this file structure.

我尝试谷歌一些关于这个文件结构的文档,但是没有关于这个文件结构的文档。

I know that this is LZW compressed file and starts with its magic number "1F 9D" but thats all I can figure out. someone please tell me more details about the file header or anything.

我知道这是LZW压缩文件,以它的神奇数字“1f9d”开始,但这就是我能弄明白的。请告诉我关于文件头的更多细节。

I am not interested about how to uncompress this file, or what linux command can process this file.

我不关心如何解压这个文件,或者linux命令可以处理这个文件。

I want to know is internal file structure/header/format/layout. thank you in advance

我想知道内部文件结构/头文件/格式/布局。提前谢谢你

3 个解决方案

#1


0  

A tar.Z file i just a compressed tar file, so you will only find the 1F 9D magic number telling you to uncompress it.

焦油。Z文件我只是一个压缩的tar文件,所以你只能找到1f9d魔术数字告诉你解压它。

When uncompressed you can read the tar file header:

当未压缩时,您可以读取tar文件头:

http://www.fileformat.info/format/tar/corion.htm

http://www.fileformat.info/format/tar/corion.htm

#2


1  

A .Z file is compressed using compress and can be uncompressed with uncompress (or on some machines this is called uncompress.real). This .Z file can hold any data. .tar.Z or .taz is just a .tar file that is compressed with compress.

一个. z文件是使用compress压缩的,可以用uncompress解压(或者在某些机器上,这个文件叫做uncompress.real)。这个. z文件可以保存任何数据。Z或.taz只是一个.tar文件,通过压缩来压缩。

The first 2 bytes (MAGIC_1 and MAGIC_2) are used to check if the .Z file really is a .Z file, and not something else with accidentally the same extension. These bytes are hardcoded in the sources.

前两个字节(MAGIC_1和MAGIC_2)用于检查. z文件是否真的是. z文件,而不是意外地具有相同扩展名的其他文件。这些字节在源代码中硬编码。

The third byte is a settings byte and holds 2 values:

第三个字节为设置字节,包含2个值:

  • The most significant bit is the block mode.
  • 最重要的位是块模式。
  • The last 5 bits indicate the maximum size of the code table (the code table is used for lzw compression).
  • 最后5位表示代码表的最大大小(用于lzw压缩的代码表)。

From the original code: BLOCK_MODE=0x80; byte3=(BIT|BLOCK_MODE); and BIT is in an if/else block where it is 12..16.

从原始代码:BLOCK_MODE=0x80;byte3 =(有些| BLOCK_MODE);位在if/else块中,在12..16。

If block mode is turned on, in the code table a entity will be added at place 256 (remember 0..255 are filled with the values 0..255) and this will contain the CLEAR sign. So whenever the CLEAR sign is gotten from the data stream from the file, the code table has to be reverted to it's initial state (so it has only 0..256 in it).

如果打开块模式,在代码表中,一个实体将被添加到place 256(记住0..)255是用0..255的值填满的),这将包含明确的标志。因此,每当从文件的数据流中获得清晰的符号时,代码表就必须返回到它的初始状态(因此它只有0。256年)。

The maximum code size indicates the amount of bits the code table can be. When the maximum is hit, there are no entities added to the code table anymore. So if the maximum code size is 0b00001100, it means that the code table can only hold 12 bits, so a maximum of 2^12=4096 entities.

最大代码大小表示代码表的位元数量。当遇到最大值时,不再向代码表添加任何实体。如果代码的最大大小为0 b00001100,这意味着代码表只能持有12位,所以最多2 ^ 12 = 4096实体。

The highest amount possible that is used by compress is 16 bit. That means that there are 2 bits in this settings field that are unused.

被压缩使用的最大容量是16位。这意味着在这个设置字段中有两个未使用的位。

After these 3 bytes the raw LZW data starts. Because the LZW table starts at 9 bits, the 4th byte will be the same as the first byte of the input (in case of a .tar.Z file, or taz file, this byte will be the first byte of the uncompressed .tar file).

在这3个字节之后,原始LZW数据开始。因为LZW表从9位开始,所以第4个字节将与输入的第一个字节相同(对于.tar来说)。Z文件,或者taz文件,这个字节将是未压缩的.tar文件的第一个字节)。

#3


0  

Q: this file can be produced with tar -Z option or using unix compress utility(result are same)

Q:可以使用tar -Z选项或unix压缩实用程序生成这个文件(结果相同)

A: Yes. "tar -cvf myfile.tar myfiles; compress myfile.tar" is equivalent to using "-Z". An even better choice is often "j" (using BZip, instead of Zip)

是的。“焦油cvf myfile。焦油myfile;压缩myfile。tar“相当于使用-Z”。一个更好的选择通常是“j”(使用BZip,而不是Zip)

Q: What is the layout of a tar file?

问:tar文件的布局是什么?

A: There are many references, and much freely available source. For example:

答:有很多参考资料,也有很多免费的资源。例如:

Q: What is the format of a Unix compressed file?

问:Unix压缩文件的格式是什么?

A: Again: many references; easy to find sample source code:

再次:许多引用;容易找到示例源代码:

Fot a .tgz (compressed tar file) you'll need both formats: you must first uncompress it, then untar it. The "tar" utility will do both for you, automagically :)

Fot a .tgz(压缩的tar文件)需要两种格式:首先要解压它,然后解压它。“tar”实用程序将为您做这两件事,自动地:)

#1


0  

A tar.Z file i just a compressed tar file, so you will only find the 1F 9D magic number telling you to uncompress it.

焦油。Z文件我只是一个压缩的tar文件,所以你只能找到1f9d魔术数字告诉你解压它。

When uncompressed you can read the tar file header:

当未压缩时,您可以读取tar文件头:

http://www.fileformat.info/format/tar/corion.htm

http://www.fileformat.info/format/tar/corion.htm

#2


1  

A .Z file is compressed using compress and can be uncompressed with uncompress (or on some machines this is called uncompress.real). This .Z file can hold any data. .tar.Z or .taz is just a .tar file that is compressed with compress.

一个. z文件是使用compress压缩的,可以用uncompress解压(或者在某些机器上,这个文件叫做uncompress.real)。这个. z文件可以保存任何数据。Z或.taz只是一个.tar文件,通过压缩来压缩。

The first 2 bytes (MAGIC_1 and MAGIC_2) are used to check if the .Z file really is a .Z file, and not something else with accidentally the same extension. These bytes are hardcoded in the sources.

前两个字节(MAGIC_1和MAGIC_2)用于检查. z文件是否真的是. z文件,而不是意外地具有相同扩展名的其他文件。这些字节在源代码中硬编码。

The third byte is a settings byte and holds 2 values:

第三个字节为设置字节,包含2个值:

  • The most significant bit is the block mode.
  • 最重要的位是块模式。
  • The last 5 bits indicate the maximum size of the code table (the code table is used for lzw compression).
  • 最后5位表示代码表的最大大小(用于lzw压缩的代码表)。

From the original code: BLOCK_MODE=0x80; byte3=(BIT|BLOCK_MODE); and BIT is in an if/else block where it is 12..16.

从原始代码:BLOCK_MODE=0x80;byte3 =(有些| BLOCK_MODE);位在if/else块中,在12..16。

If block mode is turned on, in the code table a entity will be added at place 256 (remember 0..255 are filled with the values 0..255) and this will contain the CLEAR sign. So whenever the CLEAR sign is gotten from the data stream from the file, the code table has to be reverted to it's initial state (so it has only 0..256 in it).

如果打开块模式,在代码表中,一个实体将被添加到place 256(记住0..)255是用0..255的值填满的),这将包含明确的标志。因此,每当从文件的数据流中获得清晰的符号时,代码表就必须返回到它的初始状态(因此它只有0。256年)。

The maximum code size indicates the amount of bits the code table can be. When the maximum is hit, there are no entities added to the code table anymore. So if the maximum code size is 0b00001100, it means that the code table can only hold 12 bits, so a maximum of 2^12=4096 entities.

最大代码大小表示代码表的位元数量。当遇到最大值时,不再向代码表添加任何实体。如果代码的最大大小为0 b00001100,这意味着代码表只能持有12位,所以最多2 ^ 12 = 4096实体。

The highest amount possible that is used by compress is 16 bit. That means that there are 2 bits in this settings field that are unused.

被压缩使用的最大容量是16位。这意味着在这个设置字段中有两个未使用的位。

After these 3 bytes the raw LZW data starts. Because the LZW table starts at 9 bits, the 4th byte will be the same as the first byte of the input (in case of a .tar.Z file, or taz file, this byte will be the first byte of the uncompressed .tar file).

在这3个字节之后,原始LZW数据开始。因为LZW表从9位开始,所以第4个字节将与输入的第一个字节相同(对于.tar来说)。Z文件,或者taz文件,这个字节将是未压缩的.tar文件的第一个字节)。

#3


0  

Q: this file can be produced with tar -Z option or using unix compress utility(result are same)

Q:可以使用tar -Z选项或unix压缩实用程序生成这个文件(结果相同)

A: Yes. "tar -cvf myfile.tar myfiles; compress myfile.tar" is equivalent to using "-Z". An even better choice is often "j" (using BZip, instead of Zip)

是的。“焦油cvf myfile。焦油myfile;压缩myfile。tar“相当于使用-Z”。一个更好的选择通常是“j”(使用BZip,而不是Zip)

Q: What is the layout of a tar file?

问:tar文件的布局是什么?

A: There are many references, and much freely available source. For example:

答:有很多参考资料,也有很多免费的资源。例如:

Q: What is the format of a Unix compressed file?

问:Unix压缩文件的格式是什么?

A: Again: many references; easy to find sample source code:

再次:许多引用;容易找到示例源代码:

Fot a .tgz (compressed tar file) you'll need both formats: you must first uncompress it, then untar it. The "tar" utility will do both for you, automagically :)

Fot a .tgz(压缩的tar文件)需要两种格式:首先要解压它,然后解压它。“tar”实用程序将为您做这两件事,自动地:)