Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2037 for trunk


Ignore:
Timestamp:
06/09/09 17:15:47 (15 years ago)
Author:
epitzer
Message:

Don't take ownership of underlying stream. (#672)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r1892 r2037  
    172172        string tempfile = Path.GetTempFileName();
    173173        DateTime start = DateTime.Now;
    174         Serialize(obj, File.Create(tempfile), config, includeAssemblies, compression);
     174        using (FileStream stream = File.Create(tempfile)) {
     175          Serialize(obj, stream, config, includeAssemblies, compression);
     176        }
    175177        Logger.Info(String.Format("serialization took {0} seconds with compression level {1}",
    176178          (DateTime.Now - start).TotalSeconds, compression));
     
    197199        XmlGenerator generator = new XmlGenerator();
    198200        using (ZipOutputStream zipStream = new ZipOutputStream(stream)) {
     201          zipStream.IsStreamOwner = false;
    199202          zipStream.SetLevel(compression);
    200203          zipStream.PutNextEntry(new ZipEntry("data.xml"));
Note: See TracChangeset for help on using the changeset viewer.