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