Compression Array of Bytes

Posted by Pedro Magalhaes on Stack Overflow See other posts from Stack Overflow or by Pedro Magalhaes
Published on 2010-06-05T14:52:38Z Indexed on 2010/06/05 15:02 UTC
Read the original article Hit count: 253

Filed under:

Hi,

My problem is: I want to store a array of bytes in compressed file, and then I want to read it with a good performance.

So I create a array of bytes then pass to a ZLIB algorithm then store it in the file. For my surprise the algorithm doesn't work well., probably because the array is a random sample. Using this approach, it will will be ber easy to read. Just copy the stream to memory, decompress them and copy it to a array of bytes.

But i need to compress the file. Do I have to use a algorithm, like RLE, for compresse the byte array? I think that I can store the byte array like a string and then compress it. But i think I am going to have a poor performance on reading data.

Sorry for my poor english.

Thanks

© Stack Overflow or respective owner

Related posts about compression