Skip to content

zlib.Inflater.Inflate

Andrew Lambert edited this page Dec 1, 2016 · 12 revisions

#zlib.Inflater.Inflate

##Method Signatures

 Function Inflate(Data As MemoryBlock) As MemoryBlock
 Function Inflate(ReadFrom As Readable, WriteTo As Writeable, ReadCount As Integer = -1) As Boolean

##Notes There are two versions of this method:

###Inflate(MemoryBlock) As MemoryBlock Processes compressed bytes in Data into the decompressor, and returns any uncompressed bytes that were emitted. If there was no output then a zero-length MemoryBlock is returned.

###Inflate(Readable, Writeable, Integer) As Boolean 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.

In both versions the unprocessed portion of the input is retained by the decompressor.

Inflate 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 inflate one or more bytes at the current stream position.

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

Entry-level points of interest denoted by "☜"



Clone this wiki locally