August 2003
Intermediate to advanced
928 pages
32h 1m
English
MemoryStream
This class is a stream
that keeps its data in memory as
opposed to on the disk (as a FileStream does). In
addition to the Stream methods, ToArray( ) writes the entire stream to a byte array, and
WriteTo( ) dumps the contents of this stream to a
different one.
public class MemoryStream : Stream { // Public Constructors public MemoryStream( ); public MemoryStream(byte[ ]buffer); public MemoryStream(byte[ ]buffer, boolwritable); public MemoryStream(byte[ ]buffer, intindex, intcount); public MemoryStream(byte[ ]buffer, intindex, intcount, boolwritable); public MemoryStream(byte[ ]buffer, intindex, intcount, boolwritable, boolpubliclyVisible); public MemoryStream(intcapacity); // Public Instance Properties public override bool CanRead{get; } // overrides Stream public override bool CanSeek{get; } // overrides Stream public override bool CanWrite{get; } // overrides Stream public virtual int Capacity{set; get; } public override long Length{get; } // overrides Stream public override long Position{set; get; } // overrides Stream // Public Instance Methods public override void Close( ); // overrides Stream public override void Flush( ); // overrides Stream public virtual byte[ ] GetBuffer( ); public override int Read(in byte[ ]buffer, intoffset, intcount) // overrides Stream public override int ReadByte( ); // overrides Stream public override long Seek(longoffset, SeekOriginloc); // overrides Stream public override void SetLength(longvalue ...