2011-07-04 17 views
9

このコードは、GZipでエンコードされた文字列を受け取ります。どのように私はそれをデコードすることができますか?あなたが応答を取得する前にこのプロパティを設定しStream(G#)のGZipを解凍する方法は?

request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; 

Stream stream = ret.GetResponseStream(); 

System.IO.StreamReader reader = new System.IO.StreamReader(stream, Encoding.Default); 

string answer = reader.ReadToEnd();//answer is GZip encoded string ! 

byte[] bytes = Encoding.Default.GetBytes(answer); 

//??? 

GZipStream compStream = new GZipStream(stream, CompressionMode.Decompress); 

// ... what's next? 

答えて

18

もう一つの方法は、リクエスト/レスポンスの自動解凍プロパティを使用することです。

+0

遠く離れているので、物事がはるかに簡単になります! – user1500403

関連する問題