[fpc-pascal] TStream descendant to compress/decompress gzip data from another stream

Justin Smyth htc at smythconsulting.net
Wed Mar 27 21:46:55 CET 2013


I have converted the one from fpc to its own library to do streams , can email it to you later if you wish

-----Original Message-----
From: "Michalis Kamburelis" <michalis.kambi at gmail.com>
Sent: ‎28/‎03/‎2013 6:13 AM
To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
Subject: Re: [fpc-pascal] TStream descendant to compress/decompress gzip data	from another stream

José Mejuto wrote:
> El 27/03/2013 19:22, Michalis Kamburelis escribió:
>
>> Google found an old thread on lazarus mailing list about this ("FPC,
>> gzip and stream") but without any solution, everything mentioned there
>> has either the limitations of TCompressionStream/TDecompressionStream
>> (no gzip format) or TGZFileStream (not able to work wit ObjectPascal
>> streams).
>>
>
> Hello,
>
> .gz is a quite simple format, but it can not be implemented as a TStream
> (only) descendant because in a single .gz file many files could be added
> so something like the class to handle .zip files should be used.

The existing TGZFileStream in ZStream unit already shows that it can be 
implemented, i.e. TGZFileStream reads gzip data and is a TStream 
descendant. I assume that TGZFileStream simply returns the first file 
inside a multi-file gzip (otherwise it would need to call gzopen 
multiple times, as far as I understand).

This is also my use case: I know that my .gz files should contain only 
one file (X3D standard guarantees it for me), I want to ignore the 
remaining files (if any).

>
> Parsing the .gz header is easy, and calling TCompressionStream and
> TDecompressionstream over the payload should be easy, but only for the
> first file in the .gz
>

I will probably have to implement it then. I was hoping to have 
something available ready, since ZStream contains things that are *so* 
close (but not quite) to what I want :)

Thanks,
Michalis
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130328/58fea2c7/attachment.html>


More information about the fpc-pascal mailing list