System.ZLib.TZCompressionStream

From RAD Studio API Documentation
Jump to: navigation, search

System.ZLib.TCustomZStreamSystem.Classes.TStreamSystem.TObjectTZCompressionStream

Delphi

TZCompressionStream = class(TCustomZStream)

C++

class PASCALIMPLEMENTATION TZCompressionStream : public TCustomZStream

Properties

Type Visibility Source Unit Parent
class public
System.ZLib.pas
System.ZLib.hpp
System.ZLib System.ZLib

Description

Compresses data as it is written to the stream.

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.

See Also


Code Examples