Metagnostic
home

Z-Kit for Dolphin Smalltalk

Goodies

JNIPort

Z-Kit

ListTree

Space Breakdown

F.M.B.

Ghoul

Miscellanea

Experiments

Changes

Prerequisites

Licence

This collection of packages provides facilities for handling compressed data; including ZIP file handling, and streaming [de]compression using zlib, gzip, or bzip2. It also includes the ability to read and write UNIX tar files.

The [de]compression itself is provided by two external DLLs. The zlib library is used for zlib compression (aka “Deflate” compression) and gzip compression (which is just the same compression algorithm with different headers and trailers on the data). The bzip2 library is used for (surprise!) bzip2 compression. BZip2 uses a block compression algorithm which often provides superior compression to zlib, albeit at some cost in time and memory.

Many thanks to by Jean-loup Gailly and Mark Adler, the authors of zlib, and to Julian Seward, who wrote libbzip2, for making these remarkably useful libraries available.

I don't include the DLLs themselves in this download; that seems to be the easiest way to ensure that I am complying with the conditions on redistribution (not that those conditions are in any way onerous for either library). Much more importantly, it ensures that I am not distributing a corrupt or out-of-date version of the DLLs. My code was all developed using zlib version 1.2.1, and libbzip2 version 1.0.0.

To use zlib or gzip compression (which is also used by Zip files) you will need a copy of ZLIB1.DLL, which is the official build of zlib for Windows (there are confusingly many other builds — see the zlib FAQ). ZLIB1.DLL is available pre-built for Windows here (about half-way down the page). You should put it somewhere that Dolphin can find it, either on your %PATH% or in the Dolphin installation folder.

To use bzip2 compression you will need a copy of LIBBZ2-1.?.?.DLL. That DLL is available pre-built for Windows here (for some reason, the link is in the middle of the “Getting an older version” section). You will have to rename it to LIBBZ2-1.DLL, and should put it somewhere that Dolphin can find it, either on your %PATH% or in the Dolphin installation folder.

The packages are:

ZLib Base

A low-level wrapper for the zlib library, ZLIB1.DLL. This exposes the whole of the zlib API except the plethora of functions for treating gzip files like 'C' <stdio> (for which I can see little use in Smalltalk).

ZLib Streams

Three Stream classes built on top of zlib compression.

Two kinds of write stream; these are filters that are attached to another WriteStream and either compress or decompress the data they receive before forwarding it to the underlying stream.

A decompressing read stream. This is attached to an existing ReadStream supplying compressed data, and decompresses it as you read. This also provides a configurable amount of “push back” data, in order to support algorithms that require limited read-ahead (#nextLine and #nextWord, for instance).

These streams can be configured to use the various formats and compression levels provided by zlib, including most of the “advanced” features of that library.

ZLib Streams Extras

A few trivial loose methods to supplement the ZLib Streams package.

BZip2 Base

A low-level wrapper for the bzip2 library, BZIP2-1.DLL. Like ZLib Base, this exposes the whole of the bzip2 API except the functions for handling disk files directly.

BZip2 Streams

Three Stream classes built on top of bzip2 compression. These follow exactly the same pattern as the ZLib Streams, with compressing and decompressing WriteStreams, and a decompressing ReadStream.

ZipFiles

This package uses the ZLib streams to read or write ZIP files. It is particularly aimed at manipulating such files in memory, i.e. without having to extract files to disk to read them. Similarly you can add data directly to a Zip file without writing it to a temporary file first.

It cannot handle all possible types of Zip file; it doesn't handle encryption, nor Zip archives spanning several “media” (I hate that use of the word). Also, it only understands “Deflate” compression, which is what zlib provides. It does also understand “Stored”, i.e. uncompressed, entries as well, but that's easy… There are several other compression formats that are part of the Zip file specification and which can be used by the real PKWare utilities, but those formats seem to be rare in practise — I have never seen them myself.

It can create new Zip files (as real files on disk, or as binary data in memory) and read existing files. It can also append new data to an existing file, but it does not have the ability to make arbitrary changes in-place (though it is easy enough to create a copy, applying any desired modifications as you go).

ZipFile Tree Model

Simple adaptor for using a ZipFile as the Model for a TreeView or ListTreeView.

TarFiles

This package allows you to read or write UNIX tar files. The usage is very similar (though not quite identical, unfortunately) to that of the ZIP files. When used in conjuction with the Zlib streams, or BZip2 streams, this package can also be used to read and write compressed tar files (sometimes known as tarballs).

ZipFile Tree Model

Simple adaptor for using a TarFile as the Model for a TreeView or ListTreeView.


Packages

Package sizes and versions
Name Size Version
CU ZLib Base 76877 1.00
CU ZLib Base Tests 5829 1.01
CU ZLib Streams 108533 2.00
CU ZLib Streams Extras 3698 1.00
CU ZLib Streams Tests 35941 1.01
CU BZip2 Base 23432 1.01
CU BZip2 Base Tests 6928 1.00
CU BZip2 Streams 91202 2.01
CU BZip2 Streams Tests 30125 1.01
CU ZipFiles 149792 3.00
CU ZipFile Tree Model 11904 1.02
CU ZipFiles Tests 14567 2.00
CU TarFiles 63242 1.02
CU TarFile Tree Model 13298 1.00
CU TarFiles Tests 14815 1.00

Prerequisite packages' sizes and versions
Name Size Version
CU Abstract Collections 51193 4.02
CU Always 5976 3.01
CU Null Streams 7557 1.02
CU Sortblocks 16398 3.01
CU Stream Extensions 13498 2.00
CU String Extensions 6885 1.00

Copyright © Chris Uppal, 2003-2005