Docx/fzip caused a bunch of setbacks

Source: Internet
Author: User
Tags uncompress zip extension

It is estimated that the previous analysis of EMF files is not enough. This time, I am suddenly interested in digging out the images in docx. With RIA, the B/S mode service is more convenient.

 

1. From docx, you can see what is in it after you change the suffix to zip. The image is placed in the word/media folder, and other information of the image is placed in Word/document. xml. For ooxml, you can view the meaning of those nodes when using it. This makes it faster and is not suitable for leisure. In this case, docx is not very interested in it.

 

2. From fzip, open-source libraries, compress and decompress files. This open-source library uses a coding technique. The Code is as follows:

Protected function parse (Stream: idatainput): Boolean {<br/> while (parsefunc (Stream); <br/> return (parsefunc === parseidle ); <br/>}

Parsefunc is of the function type. When a while object jumps to the parsehead, parseext, and parsecontent functions, the object header and data of each compressed file in the zip object are ended, the extended fields are all run. Similar to the indexing method mentioned in the Code Daquan, you can modify some of the abrupt if else if formats for EMF file analysis. The image in docx is quickly taken out using fzip, but it is not very interesting to do so. However, if you do not need fzip, you can obtain it manually.

 

3, deflate, zlib

Most of the Code on the internet is implemented using air, and most of the ZIP files are compressed using deflate. Therefore, after the data is extracted, an uncompress ("deflate") is processed. Nothing clever. Using RIA is fun. Ria only processes zlib, that is, most ZIP files cannot be decompressed directly using RIA. The core components of deflate and zlib are the same, while zlib has two header bytes and a four-byte verification code at the end than deflate. This way, after extracting the data, add the header and tail, then uncompress can be used to decompress the package. If you do not understand how to compress the data, you can solve the problem, but the decompression error is still reported in the experiment results. Let's look back at the content in fzip. the zlib verification code is _ adler32, but this adler32 is read in the extension field. Most zip extension fields are still 0. so I came to the conclusion that I was frustrated. If the deflate format is used for compression, the deflate format can only be used for decoding. If the information in other formats is insufficient, the function in other formats cannot be used for decoding. Frustrated!

 

4. fzip: Compression Algorithm

This open-source library is very good, and it is very attractive to compress data. It is estimated that the entire learning time is not practical. The learning content can still be used in some cases. Do more frustration and wisdom.

 

The following link is provided:

Gzip principles and implementation:

Http://blog.csdn.net/FringeDream/archive/2005/12/08/546890.aspx

Compression Algorithm deflate

Bytes

Flex zlib compressed data packet format

Http://wenyu.csai.cn/user1/24996/archives/2009/37782.html

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.