Re: string to byte[] back to string + Compression Failed!
- From: "Morten Wennevik [C# MVP]" <MortenWennevik@xxxxxxxxxxx>
- Date: Thu, 08 Feb 2007 07:43:46 +0100
Hi Jeremy,
Your problem is converting the compressed byte[] to string. After the compression a string can't hold the data the byte[] holds and you lose lots of data causing an exception when you try to decompress it.
Having Compress return a byte[] and Decompress take a byte[] will solve your problem. If you need the byte[] to be represented as string you can use Base64.
[DecompressString]
byte[] bData = Convert.FromBase64String(in_string);
[CompressString]
out_string = Convert.ToBase64String(compressed_data);
--
Happy Coding!
Morten Wennevik [C# MVP]
.
- References:
- string to byte[] back to string + Compression Failed!
- From: jeremyje
- string to byte[] back to string + Compression Failed!
- Prev by Date: Re: Interface and enums
- Next by Date: Re: Fill listview with references
- Previous by thread: string to byte[] back to string + Compression Failed!
- Next by thread: Re: string to byte[] back to string + Compression Failed!
- Index(es):
Relevant Pages
|