views:

24

answers:

1

I have a D program with Tango and I'm trying to uncompress a gzipped string. unfortunately I don't have A stream to it, but the compressed data is stored in a char[]. how can I uncompress it using tangos tango.io.compress.ZlibStream? I need another char[] with the uncompressed data.

I've been trying this for hours now. I'm not very familiar with tango.

Thank you

edit: my code looks something like this:

char[] rawData; // decoded data goes here
Array array = new Array(e.value[4..(e.value.length-3)]); // e.value is a char[]
// array slice, castet to char[] is "H4sIAAAAAAAAA2NkYGBgHMWDBgMAjw2X0pABAAA="
// array.readable returns 40 (matches the above string)
// decoded string is expected to be 33 repeatitions of "AQAAAAEAAAABAAAA"
// followed by "AQAAAA=="
auto reader = new ZlibInput(array);
ubyte[1024] buffer;
reader.read(buffer); // throws Z_DATA_ERROR
A: 

well, nevermind. It appears, the guy who designed this file format compressed the data, before he encoded it with base64. I tried to decompress still base64 encoded data.

When I decoded the string with base64 and used gzip on the resulting ubyte array, it did the trick!

sorry about that.

Lars