F
Finn Stampe Mikkelsen
Hi
I've tried below code, working with the SelfPaced Training Kit for FrameWork
2.0 (MS) and also tried to play around with the classes otherwise.. I can't
seem to get a result that actually compresses any data...
I have tried with files from around 1mb up to the below file of 250mb and
there always seems to be the same result. The files come out with a bigger
size, actually proportionat to the initial size..
Whats up with that?? What am I and aparrently MS doing wrong, since they
claim that the below code will shrink the sourcefile...
FileStream sourceFile =
File.OpenRead(@"Y:\DaffReport_20-04-2010.csv");
FileStream destFile =
File.Create(@"Y:\DaffReport_20-04-2010.zip");
//GZipStream compStream = new GZipStream(destFile,
CompressionMode.Compress);
DeflateStream compStream = new DeflateStream(destFile,
CompressionMode.Compress);
int theByte = sourceFile.ReadByte();
while (theByte != -1)
{
compStream.WriteByte((byte)theByte);
theByte = sourceFile.ReadByte();
}
sourceFile.Close();
destFile.Close();
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.
I've tried below code, working with the SelfPaced Training Kit for FrameWork
2.0 (MS) and also tried to play around with the classes otherwise.. I can't
seem to get a result that actually compresses any data...
I have tried with files from around 1mb up to the below file of 250mb and
there always seems to be the same result. The files come out with a bigger
size, actually proportionat to the initial size..
Whats up with that?? What am I and aparrently MS doing wrong, since they
claim that the below code will shrink the sourcefile...
FileStream sourceFile =
File.OpenRead(@"Y:\DaffReport_20-04-2010.csv");
FileStream destFile =
File.Create(@"Y:\DaffReport_20-04-2010.zip");
//GZipStream compStream = new GZipStream(destFile,
CompressionMode.Compress);
DeflateStream compStream = new DeflateStream(destFile,
CompressionMode.Compress);
int theByte = sourceFile.ReadByte();
while (theByte != -1)
{
compStream.WriteByte((byte)theByte);
theByte = sourceFile.ReadByte();
}
sourceFile.Close();
destFile.Close();
/Finn
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary and those who
don't.
Es gibt 10 Arten von Menschen. Die, die Binär verstehen, bzw. die, die es
nicht tuhen.