Beispiel #1
0
        public object Clone()
        {
            var stream = new MemoryIOStream <T>(FCapacity);

            stream.Length = Length;
            Array.Copy(FBuffer, stream.FBuffer, stream.FBuffer.Length);
            return(stream);
        }
Beispiel #2
0
 public void Reset()
 {
     FPosition = 0;
     if (FMemoryStream != null)
     {
         FMemoryStreamWriter.Dispose();
         FMemoryStreamWriter = null;
         FMemoryStream       = null;
     }
 }
Beispiel #3
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;
                }
            }
        }
Beispiel #4
0
 internal StreamReader(MemoryIOStream <T> stream)
 {
     FStream = stream;
 }
Beispiel #5
0
 internal StreamWriter(MemoryIOStream <T> stream)
 {
     FStream = stream;
 }