Ejemplo n.º 1
0
 public static void Append<T>(this IOutStream<T> outStream, IInStream<T> inStream)
 {
     var buffer = MemoryPool<T>.GetArray();
     try
     {
         outStream.Append(inStream, buffer);
     }
     finally
     {
         MemoryPool<T>.PutArray(buffer);
     }
 }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (FStreamWriter != null)
            {
                FStreamWriter.Dispose();
                FStreamWriter = null;

                if (FPosition > FStreamLength)
                {
                    // Stream is larger now
                    FStream.Append(FMemoryStream);
                    FMemoryStreamWriter.Dispose();
                    FMemoryStreamWriter = null;
                    FMemoryStream       = null;
                }
                else
                {
                    // Stream is smaller now
                    FStream.Length = FPosition;
                }
            }
        }