Hmmm. Just purchased, so maybe I am missing something. I copied this code out of the StreamDemo project into a VS2010 console app:
FileStream sourceStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
FileStream destStream = new FileStream(fileName + ".zip", FileMode.Create, FileAccess.Write);
CompressedStream compStream = new CompressedStream(destStream, CompressionMethod.PPMd, CompressionLevel.Normal);
private static void StreamCopy(Stream sourceStream, Stream destStream)
byte buffer = new byte;
while ((bytesRead = sourceStream.Read(buffer, 0, buffer.Length)) > 0)
destStream.Write(buffer, 0, bytesRead);
fileName is a valid XML file. I verified that the file stream is loading the file properly, and there is a zero-byte file being created for destination. However, this line: while ((bytesRead = sourceStream.Read(buffer, 0, buffer.Length)) > 0) raises this error: This CompressedStream object does not support reading or decompressing.
What am I missing?