FileStream fs =
new FileStream(@"C:\fb\tst.txt",
FileMode.Create,
FileAccess.ReadWrite);
FileStream fsCmprs =
new FileStream(@"C:\fb\txtCmprs.txt",
FileMode.Create,
FileAccess.ReadWrite);
GZipStream gzCmprs =
new GZipStream(fsCmprs,
CompressionMode.Compress);
StreamWriter sw = new StreamWriter(fs);
StreamWriter swCmprs = new StreamWriter(gzCmprs);
for (int i = 0; i < 10000; i++)
{
sw.WriteLine(String.Format("{0}_ this is a test.", i));
swCmprs.WriteLine(String.Format("{0}_ this is a test.", i));
}
sw.Flush();
sw.Close();
swCmprs.Flush();
swCmprs.Close();
gzCmprs.Close();
fsCmprs.Close();
fs.Close();
No comments:
Post a Comment