Atitit. Compression algorithm ZLib, gzip, zip best practices java. NET PHP

Source: Internet
Author: User

Atitit. compression Algorithm ZLib, gzip, zip best practices java. NET PHP

1. Classification of compression algorithm ::: Pure Algorithm , with archiving algorithm 1

2. Zlib ( for string compression ) 1

3. Gzip ( for individual files ) 1

4. zip 2

5. Java JDK support for zlib,gzip,zip 2

6. Zlib---gzip compression in the back-length comparison of 2

7. Other Bzip,,tar 2

8. References 3

1. Classification of compression algorithms::: Pure Algorithm,withArchiving algorithms

ZIP, RAR and other archiving algorithms

Zlib can be easily understood as the compression/decompression algorithm, which differs from the archive algorithm such as ZIP, RAR,

2. Zlib (suitable for string compression)

Zlib is a common, compressed open source library. Provides a function to compress and decompress in memory, including a checksum of the extracted data. the zlib of the version number only supports the deflate method, which is designed to deal with pure data (regardless of the source of the data)

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://blog.csdn.net/attilax

3. Gzip (suitable for individual files)

Gzip is also a data compression format, can be broadly divided into the head, data and tail three parts, the head and tail are mainly some document properties and validation information (rfc1952). Data is mainly compressed using the Deflate method.

Gzip is a file compression tool (or a compressed file format produced by the compression tool) that is designed to process individual files. Gzip uses zlib to compress the data in the file. In order to save information about the properties of the file. Gzip requires a lot of other header information to be stored in a compressed file (*.gz). And Zlib don't have to think about it. But gzip only works with individual files, so the compression package suffixes we see on unix/linux are *.tar.gz or *.tgz. That is, first use tar to package multiple files into a single file. The result of using gzip compression again.

4. zip

Zip is suitable for compressing multiple file formats (the corresponding tool has PKZIP and WinZip etc.), so the zip file also needs to further include the file folder structure information, much more than the GZIP header information. However, it is important to note that the ZIP format can be used in a variety of compression algorithms, most of our common ZIP files are not compressed with zlib algorithm. The format of the compressed data is very different from gzip.

5. Java JDKGiveZlib,gzip,zipthe support

The Java SDK provides support for the above three compression technologies: the Inflater class and the Deflater class directly use the Zlib library for data compression/decompression, Gzipinputstream classes and Gzipoutputstream classes provide support for gzip format, ZipFile, Zipinputstream, Zipoutputstream are used to process files in zip format

6. Zlib---gzipcompression in the back length of the comparison

Gzip>>>zlib

244>>>214

7. OtherBzip,,tar

Gzip is an algorithmic implementation of the JDK's own, but BZip2 never enjoyed it.

It's just that. The powerful Apache won't let these Linux-based algorithms disappear in the Java world.

Apache provides a corresponding implementation in the Commons Compress .

At the same time, it also contains well-known algorithms such as tar, Cpio, zip and other implementations. The most abundant of them are zip

Under Linux, Tar is an archive command. Of course, assuming that with gzip, BZIP2 will be able to achieve the effect of archive + compression!
The fact that we get archive compressed files through tar actually involves archiving and compressing two of operations. and the order of operation is to do the archive operation first. Then do the compression operation! Generally, we ignore the concept of archiving. The Archive compressed file is abbreviated as a compressed file. ~

Java compression Technology (vii) TAR--COMMONS implementation

8. References

Java compression Technology (VII) TAR--COMMONS realization-Snowolf's artistic conception space! -Iteye technology site. htm

Some things about compression-Wyingquan's column-Blog channel-CSDN.NET.htm

Atitit. Compression algorithm ZLib, gzip, zip best practices java. NET PHP

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.