Created
December 31, 2012 01:22
-
-
Save tombatron/4416637 to your computer and use it in GitHub Desktop.
Decompress zlib'd data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Ionic.Zlib; | |
namespace TestZlib | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var tbl = new Invoice(); | |
var rates = tbl.All(columns: "rates_json as Rates").First().Rates; | |
var output = new MemoryStream(); | |
using (var compressedData = new MemoryStream(rates)) | |
using (var decompressor = new ZlibStream(compressedData, CompressionMode.Decompress)) | |
{ | |
decompressor.CopyTo(output); | |
} | |
output.Position = 0; | |
var reader = new StreamReader(output); | |
Console.Write(reader.ReadToEnd()); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment