Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++DelphiTech Partner

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:

  • FileName function gets the Full Path of the file
  • FileContent function returns string data
  • ZippedFileName function returns the zipped file path

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

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

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.

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

  • JZipFile & JFileHeader are the main instances in this process.

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.

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!


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | CS(CyberSec) Undergrad at APU Malaysia | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES