[fpc-pascal] GZip - Stream decompress only in memory
Marcos Douglas
md at delfire.net
Sun Sep 4 22:01:50 CEST 2016
On Sun, Sep 4, 2016 at 4:46 PM, silvioprog <silvioprog at gmail.com> wrote:
> On Sun, Sep 4, 2016 at 1:08 PM, Marcos Douglas <md at delfire.net> wrote:
>>
>> Hi,
>>
>> I have streams compressed using GZip. I get these streams from
>> WebServices.
>> So, how can I decompress these streams only in memory?
>
> [...]
>
> Some time ago I needed something like this, and I found the following
> article that helped a lot:
>
> http://www.gocher.me/GZIP
>
> BTW I shared it here at list, but I think that it wasn't so useful for more
> users.
>
> Anyway, in attachment a small example that uncompress (in memory) a small
> compressed file named "content.tar.gz", it is just the GNU license
> compressed with Linux tar tool, the sample is going to save the uncompressed
> content in a file named "content.txt".
I tried your example, works, using your .gz file... but didn't works
using my 'stream'.
Then I open your .gz file in Notepad++ and looks like:
‹ \[sÛȱ~Ÿ:?bJ/–ªhnì\w•J %Q6 ‰RH...
But my file (stream) looks like:
H4sIAAAAAAAEAOy9TXPjSJrneV+z/Q5uedkqs0gl/N3RNrXTIAUp...
So, I think my stream has more than Gzip compress...
But I tested my stream on this site: http://www.txtwizard.net/compression
...and worked. Then I thought: maybe I need to DecodeBase64 first...
but didn't work.
I have no ideas right now.
Marcos Douglas
More information about the fpc-pascal
mailing list