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 | |
|
|