Created
December 12, 2012 11:38
-
-
Save tiernano/4267147 to your computer and use it in GitHub Desktop.
convert the object (obj) into a serialized protobuf object, compress and then write to tmpFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (MemoryStream serialized = new MemoryStream()) | |
{ | |
Serializer.Serialize(serialized, obj); | |
byte[] data = serialized.ToArray(); | |
using (FileStream fs = new FileStream(tmpFile, FileMode.Create)) | |
{ | |
using (GZipStream zip = new GZipStream(fs, CompressionMode.Compress)) | |
{ | |
zip.Write(data, 0, data.Length); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment