Article Preview
Buy Now
COLUMN
Archives in Xojo
How to Use Zip Archives
Issue: 19.4 (July/August 2021)
Author: Stefanie Juchmes
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 5,528
Starting Page Number: 81
Article Number: 19408
Resource File(s):
project 19408.zip Updated: 2021-07-01 11:16:32
Related Link(s): None
Excerpt of article text...
Archives are a very useful thing. Data can be compressed and sent by mail, for example. Did you know that you can also write archives with the MBS Xojo plugins? In a small example I would like to show you that today.
Let's start writing a Zip archive using the
ArchiveWriterMBS
class.First, we create an instance of this class. In this object, we can set different properties and use methods. We want to create a Zip archive so we use the method
SetFormatZip
. Alternatively, we could also create araw archive . In that case, we would use the methodSetFormatRaw
.For compression, we can choose between Store and Deflate for Zip. With Store the file is not compressed, with Deflate an effective compression is applied. For this we call the suitable method
ZipSetCompressionDeflate
orZipSetCompressionStore
.Now we want to define a place where we can store the Zip file later. For this, we create a folder item (e.g. on the desktop). The name of the file ends with the suffix
.zip
.Afterward, we try to put a file into the Zip archive with the method
CreateFile
. If this fails, the process is aborted. Otherwise, we create an entry for the archive. This entry is an object from the classArchiveEntryMBS
.
...End of Excerpt. Please purchase the magazine to read the full article.