Method used for compressing byte[]

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 1363
public static byte[] CompressByteArray(byte[] inputByteArray)
{
MemoryStream ms = new MemoryStream();
GZipStream compressedzipStream = new GZipStream(ms, CompressionMode.Compress, true);
compressedzipStream.Write(inputByteArray, 0, inputByteArray.Length);
compressedzipStream.Close();
return ms.ToArray();
}

Comments or Responses

Login to post response