Use Java API to compress and decompress data _ Javascript tutorial

Source: Internet
Author: User
Java API: use Java & nbsp; API to compress and decompress data. Javascript tutorial

Many data sources contain redundant data or useless data for storing information. This often results in massive data transmission between clients and server applications or computers. Obviously, the solution to data storage and information transmission problems is to install auxiliary storage devices and expand existing communication devices. However, to achieve this, you need to increase the operating costs of the organization. One way to reduce part of data storage and information transmission is to express data with more effective code. This article briefly introduces how to compress and decompress data, and how to use the java.util.zip package to compress and decompress data effectively and conveniently from the JavaTM application.

Although tools such as winzip, gzip, and Java ARchive (or jar) can be used to compress and decompress data, these tools are still used as independent applications. These tools can be called from Java applications, but they are not a simple and effective solution. This is especially true when you want to compress and decompress data quickly (such as before being transferred to a remote machine. This article will:

Summary Data Compression

Unzip java.util.zip package

Describes how to use these packages to compress and decompress data.

Describes how to compress and decompress serialized objects to save disk space.

Describes how to quickly compress and decompress data to improve the performance of client/server applications.

Overview Data Compression

The most single type of file redundancy is repeated characters. For example, the following string:

BBBBHHDDXXXXKKKKWWZZZZ

You can encode this string more concisely by replacing each repeated string with the number of repeated characters and the number of repeated characters. Therefore, the preceding string can be encoded as follows:

4B2H2D4X4K2W4Z

Here, "4B" indicates 4 B, while 2 H indicates 2 H, and so on. The encoding method for compressing strings in this way is called running length encoding.

 

[1] [2] [3] Next page

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.