Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Secrets to Quickly and Efficiently Handle Zip Files on Android with Delphi, C++ Builder, and FireMonkey

To easily handle zip files in your FireMonkey project, use the Zip4j library for zip files or streams in Delphi and C++ Builder. Zip encryption, support for the Zip64 format, support for streams, support for both AES and Zip-Standard encryption methods, and many other features distinguish Zip4j.


You can use the Zip for Android l library from WINSOFT to use this Zip4j library in your Delphi and C++ Builder FireMonkey projects. This is a commercial library with a trial version that includes all features for evaluation purposes only. If you want to distribute the Zip for Android library as part of your Android application, you must register a license.

You should be aware that you can use this Zip4j library directly by creating your own module and calling its functions from your Delphi code. However, the Zip for Android library has already provided you with all of the required modules. It means that you can use Zip4j functionalities without having to create modules in a short period of time.

You can use Zip Parameters to create, add, extract, update, and remove files from a Zip file using this Zip for Androidlibrary. Furthermore, you can easily obtain zip file header data to learn about Zip file configurations.

In this post, we’ll investigate the features of the Zip for Android library. The first step is to incorporate the library into your IDE Software.

Here’s a quick guide to installing the library.

The next step is to add the zip4j-2.5.3-SNAPSHOT.jar file into your Android 32-bit library list by add option here:

Add Library

Result:

Result

User interface:

So, you can watch this short video showing the demo in action or you can just follow this article and learn the main features and use cases of the Zip for Android library. 

Here are our helper functions:

[crayon-672a39d83c130388274419/]

To utilize Zip for Android library we should add Winsoft.Android.Zip unit to uses section with other units:

[crayon-672a39d83c13b039274651/]

Now, we can discover how this library is creating Zip files.

[crayon-672a39d83c13e108008854/]

As you can see this is what we need to create Zip files. With the help of a JZipFile instance (ZipFile) we can create Zip files and set Zip parameters like compression method & level, and encryption method. Furthermore, we may encrypt files with a password.

[crayon-672a39d83c13f775234135/]

Now, learn how to list files in the zip archive here.

[crayon-672a39d83c141261950529/]
[crayon-672a39d83c143734669707/]

In this function, we are opening a zip file by creating an instance of JZipFile. Then it gets file header data like compressed size and after that, it is printing header data on TMemo component.
Finally, we should see how to extract zip files. We just need a JZipFile instance to open zip files and extract them. You can utilize the extractAll function.

[crayon-672a39d83c144467499155/]

Great! We have learned the essential features of the Zip for Android library.

Like what you see? You can get Zip for Android and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!

Exit mobile version