By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

Base64 encoded compressed webresponse

P: n/a
Sorted my problem.

Issue - retrieve Base64 encoded Zlib compressed XML stream.

The compressed XML stream was compressed using Zlib on a Java

Resolution. (VB.NET)

1) Retrieve XML stream using webresponse class
2) Convert the base64 encoded stream into a byte array
3) Feed the byte array into the amazing SharpZipLib C# library
developed by Mike Krueger. (available at
4) Retirieved the resulting byte array into a string.

Code in VB.NET is below (steps 2-4)

'string containing data
dim b64stringas string = "mybase64encoded_compressed_string"
'decode base64 encoded string into a bte array
Dim data() As Byte = Convert.FromBase64String(b64string)
'declare my variables for using the SharpZipLib componant
dim strresult as String
dim totalLength as long= 0
dim writedata(4096) as Byte
dim size as Integer
'make memory stream to feed into InflaterInputStream
dim s2 as Stream = new
ICSharpCode.SharpZipLib.Zip.Compression.Streams.In flaterInputStream(new
do while true
size = s2.Read(writeData, 0, writeData.Length)
if (size > 0)
strResult+=System.Text.Encoding.UTF8.GetString(wri teData,
exit Do
End If
'write the results out to a file
Dim objReader As StreamWriter
objReader = New StreamWriter("c:\hereyougo.txt")
Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.