Table of Contents

Codeunit "Data Compression"

ID 425
Namespace: System.IO

Exposes functionality to provide ability to create, update, read and dispose a binary data compression archive. This module supports compression and decompression with Zip format and GZip format.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

CreateZipArchive

Creates a new ZipArchive instance.

procedure CreateZipArchive()

OpenZipArchive

Creates a ZipArchive instance from the given InStream.

procedure OpenZipArchive(InputInStream: InStream, OpenForUpdate: Boolean)

Parameters

Name Type Description
InputInStream InStream

The InStream that contains the content of the compressed archive.

OpenForUpdate Boolean

Indicates whether the archive should be opened in Update mode. The default (false) indicated the archive will be opened in Read mode.

OpenZipArchive

Creates a ZipArchive instance from the given InStream.

procedure OpenZipArchive(InputInStream: InStream, OpenForUpdate: Boolean, EncodingCodePageNumber: Integer)

Parameters

Name Type Description
InputInStream InStream

The InStream that contains the content of the compressed archive.

OpenForUpdate Boolean

Indicates whether the archive should be opened in Update mode. The default (false) indicated the archive will be opened in Read mode.

EncodingCodePageNumber Integer

Specifies the code page number of the text encoding which is used for the compressed archive entry names in the input stream.

OpenZipArchive

Creates a ZipArchive instance from the given instance of Temp Blob codeunit.

procedure OpenZipArchive(TempBlob: Codeunit "Temp Blob", OpenForUpdate: Boolean)

Parameters

Name Type Description
TempBlob Codeunit System.Utilities."Temp Blob"

The instance of Temp Blob codeunit that contains the content of the compressed archive.

OpenForUpdate Boolean

Indicates whether the archive should be opened in Update mode. The default (false) indicated the archive will be opened in Read mode.

SaveZipArchive

Saves the ZipArchive to the given OutStream.

procedure SaveZipArchive(OutputOutStream: OutStream)

Parameters

Name Type Description
OutputOutStream OutStream

The OutStream to which the ZipArchive is saved.

SaveZipArchive

Saves the ZipArchive to the given instance of Temp Blob codeunit.

procedure SaveZipArchive(var TempBlob: Codeunit "Temp Blob")

Parameters

Name Type Description
TempBlob Codeunit System.Utilities."Temp Blob"

The instance of the Temp Blob codeunit to which the ZipArchive is saved.

CloseZipArchive

Disposes the ZipArchive.

procedure CloseZipArchive()

GetEntryList

Returns the list of entries for the ZipArchive.

procedure GetEntryList(var EntryList: List of [Text])

Parameters

Name Type Description
EntryList List of [Text]

The list that is populated with the list of entries of the ZipArchive instance.

ExtractEntry

Obsolete

This element will become obsolete from version 23.0. This function has been replaced by the function ExtractEntry(EntryName: Text; OutputOutStream: OutStream) which instead returns the entry length.

Extracts an entry from the ZipArchive.

[Obsolete(This function has been replaced by the function ExtractEntry(EntryName: Text; OutputOutStream: OutStream) which instead returns the entry length.,23.0)]
procedure ExtractEntry(EntryName: Text, OutputOutStream: OutStream, var EntryLength: Integer)

Parameters

Name Type Description
EntryName Text

The name of the ZipArchive entry to be extracted.

OutputOutStream OutStream

The OutStream to which binary content of the extracted entry is saved.

EntryLength Integer

The length of the extracted entry.

ExtractEntry

Extracts an entry from the ZipArchive.

procedure ExtractEntry(EntryName: Text, OutputOutStream: OutStream): Integer

Parameters

Name Type Description
EntryName Text

The name of the ZipArchive entry to be extracted.

OutputOutStream OutStream

The OutStream to which binary content of the extracted entry is saved.

Returns

Type Description
Integer

The length of the extracted entry.

ExtractEntry

Extracts an entry from the ZipArchive to a TempBlob instance.

procedure ExtractEntry(EntryName: Text, var TempBlob: Codeunit "Temp Blob"): Integer

Parameters

Name Type Description
EntryName Text

The name of the ZipArchive entry to be extracted.

TempBlob Codeunit System.Utilities."Temp Blob"

The TempBlob the uncompressed binary data will be written to.

Returns

Type Description
Integer

AddEntry

Adds an entry to the ZipArchive.

procedure AddEntry(InStreamToAdd: InStream, PathInArchive: Text)

Parameters

Name Type Description
InStreamToAdd InStream

The InStream that contains the binary content that should be added as an entry in the ZipArchive.

PathInArchive Text

The path that the added entry should have within the ZipArchive.

RemoveEntry

Removes an entry from the ZipArchive.

procedure RemoveEntry(PathInArchive: Text)

Parameters

Name Type Description
PathInArchive Text

The path that the removed entry should have within the ZipArchive.

IsGZip

Determines whether the given InStream is compressed with GZip.

procedure IsGZip(InStream: InStream): Boolean

Parameters

Name Type Description
InStream InStream

An InStream that contains binary content.

Returns

Type Description
Boolean

Returns true if and only if the given InStream is compressed with GZip

IsZip

Determines whether the given InStream is compressed with Zip.

procedure IsZip(InStream: InStream): Boolean

Parameters

Name Type Description
InStream InStream

An InStream that contains binary content.

Returns

Type Description
Boolean

Returns true if and only if the given InStream is compressed with Zip

GZipCompress

Compresses a stream with GZip algorithm.

The InStream that contains the content that should be compressed. The OutStream into which the compressed stream is copied to.
procedure GZipCompress(InputInStream: InStream, CompressedOutStream: OutStream)

Parameters

Name Type Description
InputInStream InStream
CompressedOutStream OutStream

GZipDecompress

Decompresses a GZipStream.

The InStream that contains the content that should be decompressed. The OutStream into which the decompressed stream is copied to.
procedure GZipDecompress(InputInStream: InStream, DecompressedOutStream: OutStream)

Parameters

Name Type Description
InputInStream InStream
DecompressedOutStream OutStream

See also