Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/29/08 17:55:35 (16 years ago)
Author:
gkronber
Message:

moved GZip persistence into the PersistenceManager in HeuristicLab.Core because compression is needed in several plugins (CEDMA and Grid)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/PersistenceManager.cs

    r267 r402  
    2525using System.Xml;
    2626using System.IO;
     27using System.IO.Compression;
    2728
    2829namespace HeuristicLab.Core {
     
    8687    }
    8788
     89    public static IStorable RestoreFromGZip(byte[] serializedStorable) {
     90      GZipStream stream = new GZipStream(new MemoryStream(serializedStorable), CompressionMode.Decompress);
     91      return Load(stream);
     92    }
     93
     94    public static byte[] SaveToGZip(IStorable storable) {
     95      MemoryStream memStream = new MemoryStream();
     96      GZipStream stream = new GZipStream(memStream, CompressionMode.Compress, true);
     97      Save(storable, stream);
     98      stream.Close();
     99      return memStream.ToArray();
     100    }
     101
    88102    public static string BuildTypeString(Type type) {
    89103      string assembly = type.Assembly.FullName;
Note: See TracChangeset for help on using the changeset viewer.