Delphi Inspiration – Delphi Components and Software Applications

DIZipWriter

DIZipWriter is a Delphi component to create PKZip-compatible ZIP archives. Archive output is completely stream-based and works with any TStream descendant. DIZipWriter therefore direclty writes to files (TFileStream), memory (TMemoryStream), or even database BLOBs (TBlobStream). Convenience functions to work files and file based archives are available.

DIZipWriter's functionality is contained in its main class, TDIZipWriter, with methods to create new ZIP archives and write various types of data like:

  • Files
  • Streams
  • Strings
  • Memory Buffers

DIZipWriter allows applications to write to an archive entry as many times as they seem necessary. This allows to create the new archive entry even before the first chunk of data is available. As data flows in (for example from a slow download), they can write it in small chunks at a time.

DIZipWriter outputs all data to the archive straight away, with no need for temporary storage: It does not create any temporary files and does not use huge amount of memory for buffering. It is nevertheless possible to create an archive entirely in memory if desired.

DIZipWriter stores a global archive comment as well as individual comments for each individual entry. Long file names are supported, just as absolute and relative path names.

Direct Streaming

Direct streaming allows objects to stream their data directly to a ZIP archive using their own SaveToStream procedure:

// Save a TBitMap image to a ZIP archive.
 
// Create and initialize a bitmap image.
Img := TBitMap.Create;
// Add a new entry to the ZIP archive.
DIZipWriter.AddEntry('MyImage');
// Write the bitmap to the archive's entry stream.
Img.SaveToStream(DIZipWriter.CurrentEntryStream);
 
// Save a database BLOB to a ZIP archive.
MyBlob.SaveToStream(DIZipWriter.CurrentEntryStream);

Direct streaming is very efficient because its avoids all temporary storage of bitmap and BLOB data. Other ZIP writing libraries usually require this extra step and forece applications to touch object data at least twice: 1st for streaming it out and 2nd for reading it back. Omitting this extra step helps DIZipWriter to perform faster and uses less resources than the competition.

Advanced Encryption

Strong 256-bit AES encryption, a ZIP extension of WinZip 9, is available with DIZipWriter. WinZip 9 and later versions as well as 7-Zip starting from version 4.43 beta can open strong encryption archives created by DIZipWriter just like any ZIP file with standard or no encryption. The PKZip standard compression is of course also supported by DIZipWriter, but it is considered weak and no longer recommended.

products/zipwriter/index.txt · Last modified: 2008/11/24 22:33 (external edit)