/// <summary>
/// Decompress the Stream
/// </summary>
/// <param name="data">Compress data</param>
/// <returns></returns>
static byte[] Decompress(byte[] data)
{
try
{
using (var compressedStream = new MemoryStream(data))
using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
using (var resultStream = new MemoryStream())
{
zipStream.CopyTo(resultStream);
return resultStream.ToArray();
}
}
catch
{
throw;
}
}
/// Decompress the Stream
/// </summary>
/// <param name="data">Compress data</param>
/// <returns></returns>
static byte[] Decompress(byte[] data)
{
try
{
using (var compressedStream = new MemoryStream(data))
using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
using (var resultStream = new MemoryStream())
{
zipStream.CopyTo(resultStream);
return resultStream.ToArray();
}
}
catch
{
throw;
}
}
No comments:
Post a Comment