DelphiBasics
  Home  |  Delphi .net Home  |  System.IO NameSpace
 .NET Framework
 Namespace References

 System
 System.Collections
 System.Globalization
 System.IO
 
  BinaryReader  Class 
  BinaryWriter  Class 
  BufferedStream  Class 
  Directory  Class 
  DirectoryInfo  Class 
  File  Class 
  FileAccess  Enumeration 
  FileAttributes  Enumeration 
  FileInfo  Class 
  FileMode  Enumeration 
  FileShare  Enumeration 
  FileStream  Class 
  FileSystemWatcher  Class 
  MemoryStream  Class 
  Path  Class 
  SeekOrigin  Enumeration 
  StreamReader  Class 
  StreamWriter  Class 
  StringReader  Class 
  StringWriter  Class 

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 php Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders


 
 
  System.IO.MemoryStream Class
 
 Description
The MemoryStream class uses memory as a store for data, allowing direct access for reading and writing.
 
The whole memory stream (block) can be extracted into an array of bytes - likewise, it can be constructed from such an array.
 
Important : when constructing from an array of bytes, the capacity of the stream is fixed by the number of bytes stored.
 Syntax
Constructor Create ( );
Constructor Create ( InitialCapacity : Integer ; );
Constructor Create ( Bytes : Array of Byte ; );
Constructor Create ( Bytes : Array of Byte; CanWrite : Boolean );
Constructor Create ( Bytes : Array of Byte; StartIndex : Integer; Count : Integer );
Constructor Create ( Bytes : Array of Byte; StartIndex : Integer; Count : Integer; CanWrite : Boolean );
Constructor Create ( Bytes : Array of Byte; StartIndex : Integer; Count : Integer; CanWrite : Boolean; CanGetBuffer : Boolean );
 Methods
Close  Close the current Memory stream
Read  Returns a block of bytes from the current position in the Memory Stream
ReadByte  Returns the next byte from the current position inthe Memory Stream
Seek  Moves the current position in the Memory Stream to the specified value
SetLength  Sets the length of the memory stream
ToArray  Extracts the current Memory Streaminto an Array of Bytes
Write  Write some or all of an Array of Bytes into the current memory Stream
WriteByte  Writes a Byte to the current position in the Memory Stream
WriteTo  Writes the complete current Memory Stream to another stream

 Properties
CanRead  Boolean  Gets a value indicating whether the current stream supports reading.
CanSeek  Boplean  Gets a value indicating whether the current stream supports seeking.
CanWrite  Boolean  Gets a value indicating whether the current stream supports writing.
Capacity  Integer  Gets or sets the number of bytes allocated for this stream.
Length  Int64  Gets the length of the stream in bytes.
Position  Int64  Gets or sets the current position within the stream.

 Microsoft MSDN links
 
System.IO
System.IO.memorystream
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page