decompress( MemoryStream XmlCompressedStream ) { /////////////////////////////////////////////////////// XmlCompressedStream.Position = 0; MemoryStream XmlDecompressedStream = new MemoryStream(); ExiStream ExiDecompressor = new ExiStream(XmlCompressedStream, CompressionMode.Decompress, true); ExiDecompressor.CopyTo(XmlDecompressedStream); /*** Pulizia e rilascio delle risorse allocate dal decompressore ***/ ExiDecompressor.Close(); ExiDecompressor.Dispose(); return XmlDecompressedStream; } // End of method decompress()
compress( MemoryStream XmlStream ) { /////////////////////////////////////// XmlStream.Position = 0; MemoryStream XmlCompressedStream = new MemoryStream(); ExiStream ExiCompressor = new ExiStream(XmlCompressedStream, CompressionMode.Compress, true); XmlStream.CopyTo(ExiCompressor); /*** Chiusura del compressore (la chiusura avverrà solo a scrittura completata) ***/ ExiCompressor.Close(); /*** Rilascio delle risorse ***/ ExiCompressor.Dispose(); return XmlCompressedStream; } // End of method compress()