RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TZCompressionStream Class

Compresses data as it is written to the stream.

Pascal
TZCompressionStream = class(TCustomZStream);
C++
class TZCompressionStream : public TCustomZStream;

TZCompressionStream is a write-only, sequential access stream that compresses data as it is written. The compressed data is written to a separate stream, which is passed to the TZCompressionStream constructor. TZCompressionStream does not take ownership of the output stream; you are responsible for creating, initializing, and destroying the stream when it is no longer needed. 

Reading from a TZCompressionStream object will raise an exception of type ECompressionError, with the message string set to "Invalid Stream Operation." Similarly, a Seek operation causes an ECompressionError exception, however, you can perform a Seek operation with a zero offset from the current position. This will return the number of raw, uncompressed bytes that have been written to the stream. 

You set the compression level to be used when you create the stream object. The possible compression levels are: clNone, clFastest, clDefault, and clMax. 

When the stream's output buffer is filled, a Write operation on TZCompressionStream will write the contents of the buffer to the output stream, and then call the OnProgress event. You can use the OnProgress event to update a user interface control such as a progress indicator. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!