Skip to content

BZip2.Decompressor.Decompress

Andrew Lambert edited this page Nov 27, 2022 · 3 revisions

BZip2.Decompressor.Decompress

Method Signature

  Function Decompress(ReadFrom As Readable, WriteTo As Writeable, ReadCount As Integer = -1) As Boolean

Parameters

Name Type Comment
ReadFrom Readable The stream from which to read compressed data.
WriteTo Writeable The stream to which decompressed data will be written.
ReadCount Integer Optional. If specified, the number of compressed bytes to read.

Remarks

This method processes compressed bytes from ReadFrom into the decompressor, and writes any uncompressed bytes that were emitted to WriteTo. If ReadCount is specified then exactly ReadCount compressed bytes are read; otherwise compressed bytes will continue to be read until ReadFrom.EOF=True.

This method does not necessarily emit uncompressed bytes immediately. The "sliding window" used by the compressor determines how far ahead the decompressor has to read in order to Decompress one or more bytes at the current stream position. The unprocessed portion of the input is retained by the decompressor until a subsequent call to this method.

If the decompressor needed more compressed bytes than were provided then zero bytes will be emitted and Avail_In will be >0. Call Decompress again with more compressed bytes until Avail_In=0. If there are no more compressed bytes then the compressed stream is corrupt.

Clone this wiki locally