2


3


4


5


6


7


8


9


10


11


12


13


14


15


16


17


18


19


20


21


22


23


24




 


 


​function​​ ​​CFFunc​​​​.​​​​Compression​​​​.​​​​Zlib​​​​.​​​​DeCompressionStream(​​​​const​​ ​​AInStream,​


​AOutStream: TStream) : ​​​​Boolean​​​​;​


​var​


​ds : TDeCompressionStream;​


​buff : ​​​​array​​​​[​​​​1..4096​​​​] ​​​​of​​ ​​Byte​​​​;​


​iread : ​​​​integer​​​​;​


​begin​


​Result  :=  ​​​​True​​​​;​


​AInStream​​​​.​​​​Position := ​​​​0​​​​;​


​try​


​ds := TDeCompressionStream​​​​.​​​​Create(AInStream);​


​try​


​repeat​


​iread := ds​​​​.​​​​Read(buff, sizeof(buff));​


​if​​ ​​iread > ​​​​0​​ ​​then​


​AOutStream​​​​.​​​​Write​​​​(buff, iread);​


​until​​ ​​(iRead = ​​​​0​​​​);​


​finally​


​ds​​​​.​​​​Free;​


​end​​​​;​


​except​


​Result  :=  ​​​​False​​​​;​


​end​​​​;​


​end​​​​;​