Skip to content

Better code

mal suhash

Asked Dec 6, 2008, 1:57 AM EST1 answer
Share
LinkedInX

Hi there,

Please check the following code.

Is there a better or elegant way of writing the below code?

Thanks, M.

Java
FileStream fs = File.OpenRead("c:\\aaa.zip");
GZipStream g = new GZipStream(fs, CompressionMode.Decompress);
StringBuilder sb = new StringBuilder();
int b = fs.ReadByte();
while (b != -1)
{
sb.Append((char)b);
b = fs.ReadByte();
}
Console.WriteLine(sb.ToString());

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.