Read and write gzip files easily.

Stephan Schiffels stephan_schiffels at mac.com
Thu Feb 20 11:54:23 PST 2014


On Thursday, 20 February 2014 at 17:05:37 UTC, Kamil Slowikowski
wrote:
> On Thursday, 20 February 2014 at 10:35:50 UTC, Stephan 
> Schiffels wrote:
>> Hi Kamil,
>> I am glad someone has the exact same problem as I had. I 
>> actually solved this, inspired by the python API you quoted 
>> above. I wrote these classes:
>> GzipInputRange, GzipByLine, and GzipOut.
>
> Stephan, awesome! Thank you very much for sharing your classes. 
> It's nice to see how you've approached this problem. Your code 
> is very clear and easy to understand (for me).
>
> Also, I now see the error in my code: I believe I should use 
> rawWrite to write compressed data and not writeExact.

You're welcome. If you manage to put GzipOut.finish() into the
destructor of the class to automatically flush the file upon
destruction of the object, let me know. I tried this and it gives
a SegFault… I was too lazy to try to understand it but I am sure
it must be in principle possible.

Stephan


More information about the Digitalmars-d mailing list