Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kStatus kDat5Serializer_EnableCompression ( kDat5Serializer  serializer,
kCompressionType  algorithm,
k32s  level 
)

Enables the use of compression in serialization.

By default, kDat5Serializer data is uncompressed. This method can be used to specify a compression algorithm to be used when serializing objects.

When compression is enabled via this method, metadata is encoded in the stream such that the required decompression approach will be automatically detected during object deserialization. Accordingly, this method should not be called when deserializing data.

The use of compression requires that the underlying stream object (e.g., kFile) created by the receiver provides a read buffer. Configure the read stream to allocate a read buffer before passing the stream to the deserializer constructor.

The Zen library does not itself provide compression algorithms. If compression support is required, an additional assembly that implements compression must first be loaded. Refer to the documentation for the selected compression stream type for information about additional requirements or restrictions that might apply.

Support for this feature was introduced in Zen 6.2.1. Older versions cannot read or write compressed content.

Parameters
serializerSerializer object.
algorithmCompression algorithm type (null to disable).
levelCompression level; accepts kCompressionPreset value or compressor-specific value.
Returns
Operation status.