Android implementation of compressed string method example

preface

The Android side can compress the string. When transmitting a large number of simple text, we can compress the string first and then send it. The receiver receives it and then decompresses it. You can also compress the string and store it in the database. I won't say much below. Let's take a look at the detailed introduction together.

Class library used

GZIPOutputStream

Code example

Red rice mobile phone test output

The storage time is affected by the length of the stored string. String length is positively correlated with storage time.

Glory mobile phone test

In this example, the glory compression takes about 5ms and the decompression takes about 25ms.

It can be seen that the ratio of compressed to original length is 1112 / 304304, about 0.365%

Compression and decompression time depends on the phone.

summary

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>