Hi,
I'm using System.IO.Compression to gzip a small file (8 Kb) and once
gzipped it ends up being 12 kb..... not what I wanted !
my code :
Stream src = null;
Stream dest = File.Create("test.gz");
using (src = File.OpenRead("test.JPG"))
{
using (dest)
{
Compress(src, dest);
}
}
private static void Compress(Stream source, Stream destination)
{
using (GZipStream output = new GZipStream(destination,
CompressionMode.Compress))
{
Pump(source, output);
}
}
private static void Pump(Stream input, Stream output)
{
byte[] bytes = new byte[4096];
int n;
while ((n = input.Read(bytes, 0, bytes.Length)) != 0)
{
output.Write(bytes, 0, n);
}
}
Am I doing something wrong ?