Skip to content

zlib.Deflater.Deflate

Andrew Lambert edited this page Nov 23, 2016 · 17 revisions

#zlib.Deflater.Deflate

##Method Signatures

 Function Deflate(Data As MemoryBlock, Flushing As Integer = zlib.Z_NO_FLUSH) As MemoryBlock
 Function Deflate(ReadFrom As Readable, WriteTo As Writeable, Flushing As Integer = zlib.Z_NO_FLUSH) As Boolean

##Notes There are two versions of this method:

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

###Deflate(Readable, Writeable, Integer) As Boolean Processes uncompressed bytes from ReadFrom into the compressor, and writes any compressed bytes that were emitted to WriteTo. Uncompressed bytes will be read until ReadFrom.EOF=True.

In both versions the unprocessed portion of the input is retained by the compressor until a subsequent call to this method.

Deflate does not necessarily consume uncompressed data immediately. The "sliding window" determines the size of the compression buffer, and the size of the compression buffer determines how many uncompressed bytes have to be consumed in order to emit one or more compressed bytes.

If the compressor needed more uncompressed bytes than were provided then zero bytes will be emitted and Avail_Out will be >0. Call Deflate again with more uncompressed bytes until Avail_Out=0. If there are no more uncompressed bytes then call Deflate with zero uncompressed bytes and Z_FINISH.

Entry-level points of interest denoted by "☜"



Clone this wiki locally