GZipObjectSerializer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities.DurableInstancing / System / Activities / DurableInstancing / GZipObjectSerializer.cs / 1305376 / GZipObjectSerializer.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.DurableInstancing 
{
    using System.Collections.Generic; 
    using System.IO; 
    using System.IO.Compression;
    using System.Xml.Linq; 

    sealed class GZipObjectSerializer : DefaultObjectSerializer
    {
        protected override Dictionary DeserializePropertyBag(Stream stream) 
        {
            using (GZipStream gzip = new GZipStream(stream, CompressionMode.Decompress, true)) 
            { 
                return base.DeserializePropertyBag(gzip);
            } 
        }
        protected override object DeserializeValue(Stream stream)
        {
            using (GZipStream gzip = new GZipStream(stream, CompressionMode.Decompress, true)) 
            {
                return base.DeserializeValue(gzip); 
            } 
        }
 
        protected override void SerializePropertyBag(Stream stream, Dictionary propertyBag)
        {
            using (GZipStream gzip = new GZipStream(stream, CompressionMode.Compress, true))
            { 
                base.SerializePropertyBag(gzip, propertyBag);
            } 
        } 

        protected override void SerializeValue(Stream stream, object value) 
        {
            using (GZipStream gzip = new GZipStream(stream, CompressionMode.Compress, true))
            {
                base.SerializeValue(gzip, value); 
            }
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK