TROConstantMemoryStream

Overview

TROConstantMemoryStream is a custom memory stream implementation, optimized for read-only access.

Use Case

This class was originally implemented for internal use within the Remoting SDK library, but provided publicly for your convenience. You can use TROConstantMemoryStream wherever a un-modifiable memory stream optimized for fast read-only access is needed.

Location

 

constructor Create  overload    (declared in TROBinaryMemoryStream)

Creates a new instance.

constructor Create

constructor Create (Ansistring)  overload    (declared in TROBinaryMemoryStream)

Creates a new instance from given string.

constructor Create(const aString: Ansistring)

Parameters:

  • aString: given string

constructor Create (ROAnsiString)  overload    (declared in TROBinaryMemoryStream)

Creates a new instance from given string.

constructor Create(const aString: ROAnsiString)

Parameters:

  • aString: given string

constructor Create (TCustomMemoryStream, boolean)  reintroduce

Creates a new instance.

constructor Create(aStream: TCustomMemoryStream; aFreeOldStream: boolean)

Parameters:

  • aStream: stream
  • aFreeOldStream: allows to destroy aStream after copying of his content

Assign  virtual    (declared in TROBinaryMemoryStream)

Copies data from a given source.

procedure Assign(iSource: TStream)

Parameters:

  • iSource: Instance whose properties will be copied

CapacityIncrement    (declared in TROBinaryMemoryStream)

The amount by which the capacity of the stream is automatically incremented when its size becomes greater than its capacity.

property CapacityIncrement: integer read write

Clone    (declared in TROBinaryMemoryStream)

Creates and returns a new memory stream that is an identical copy of the current stream. The new stream will receive its own copy of the data, and any changes to data or stream position will not affect the original version.

function Clone: TROBinaryMemoryStream

LoadFromHexString    (declared in TROBinaryMemoryStream)

Loads the binary from a string containing data in hexadecimal representation. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromHexString(aHexString: ROAnsiString)

Parameters:

  • aHexString: string containing data in hexadecimal representation

LoadFromString (Ansistring)  overload    (declared in TROBinaryMemoryStream)

Loads the binary from a string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromString(const aString: Ansistring)

Parameters:

  • aString: string

LoadFromString (ROAnsiString)  overload    (declared in TROBinaryMemoryStream)

Loads the binary from a string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromString(const aString: ROAnsiString)

Parameters:

  • aString: string

LoadFromUTF8String    (declared in TROBinaryMemoryStream)

Loads the binary from a UTF8string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromUTF8String(const aString: UnicodeString)

Parameters:

  • aString: string

ToHexString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as a string containing hexadecimal characters. For each byte in the original stream, two characters between '0' and 'F' will be emitted to the string.

function ToHexString: ROAnsiString

ToReadableString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as an ansi string for display purposes. For each byte in the original stream, the corresponding ASCII character will be emitted to the string if the value is $0D or between $20 and $7F, and a "period" character will be emitted otherwise. This results in a string that can cleanly be displayed and does not contain ASCII control characters.

function ToReadableString: ROAnsiString

ToString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as an ansi string. For each byte in the original stream, the corresponding ANSI character will be emitted to the string.

function ToString: ROAnsiString

Write  override

Raises exception that Stream is read-only.

function Write(const Buffer: ; Count: Longint): Longint

Parameters:

  • Buffer: Buffer
  • Count: Count

WriteAnsiString    (declared in TROBinaryMemoryStream)

Writes a ROAnsiString value.

function WriteAnsiString(anAnsiString: ROAnsiString): integer

Parameters:

  • anAnsiString: a string

 

CapacityIncrement    (declared in TROBinaryMemoryStream)

The amount by which the capacity of the stream is automatically incremented when its size becomes greater than its capacity.

property CapacityIncrement: integer read write

 

constructor Create  overload    (declared in TROBinaryMemoryStream)

Creates a new instance.

constructor Create

constructor Create (Ansistring)  overload    (declared in TROBinaryMemoryStream)

Creates a new instance from given string.

constructor Create(const aString: Ansistring)

Parameters:

  • aString: given string

constructor Create (ROAnsiString)  overload    (declared in TROBinaryMemoryStream)

Creates a new instance from given string.

constructor Create(const aString: ROAnsiString)

Parameters:

  • aString: given string

constructor Create (TCustomMemoryStream, boolean)  reintroduce

Creates a new instance.

constructor Create(aStream: TCustomMemoryStream; aFreeOldStream: boolean)

Parameters:

  • aStream: stream
  • aFreeOldStream: allows to destroy aStream after copying of his content

Assign  virtual    (declared in TROBinaryMemoryStream)

Copies data from a given source.

procedure Assign(iSource: TStream)

Parameters:

  • iSource: Instance whose properties will be copied

Clone    (declared in TROBinaryMemoryStream)

Creates and returns a new memory stream that is an identical copy of the current stream. The new stream will receive its own copy of the data, and any changes to data or stream position will not affect the original version.

function Clone: TROBinaryMemoryStream

LoadFromHexString    (declared in TROBinaryMemoryStream)

Loads the binary from a string containing data in hexadecimal representation. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromHexString(aHexString: ROAnsiString)

Parameters:

  • aHexString: string containing data in hexadecimal representation

LoadFromString (Ansistring)  overload    (declared in TROBinaryMemoryStream)

Loads the binary from a string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromString(const aString: Ansistring)

Parameters:

  • aString: string

LoadFromString (ROAnsiString)  overload    (declared in TROBinaryMemoryStream)

Loads the binary from a string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromString(const aString: ROAnsiString)

Parameters:

  • aString: string

LoadFromUTF8String    (declared in TROBinaryMemoryStream)

Loads the binary from a UTF8string. The new data will replace the entire stream and the stream will be positioned at the beginning.

procedure LoadFromUTF8String(const aString: UnicodeString)

Parameters:

  • aString: string

ToHexString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as a string containing hexadecimal characters. For each byte in the original stream, two characters between '0' and 'F' will be emitted to the string.

function ToHexString: ROAnsiString

ToReadableString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as an ansi string for display purposes. For each byte in the original stream, the corresponding ASCII character will be emitted to the string if the value is $0D or between $20 and $7F, and a "period" character will be emitted otherwise. This results in a string that can cleanly be displayed and does not contain ASCII control characters.

function ToReadableString: ROAnsiString

ToString    (declared in TROBinaryMemoryStream)

Emits the data in the stream as an ansi string. For each byte in the original stream, the corresponding ANSI character will be emitted to the string.

function ToString: ROAnsiString

Write  override

Raises exception that Stream is read-only.

function Write(const Buffer: ; Count: Longint): Longint

Parameters:

  • Buffer: Buffer
  • Count: Count

WriteAnsiString    (declared in TROBinaryMemoryStream)

Writes a ROAnsiString value.

function WriteAnsiString(anAnsiString: ROAnsiString): integer

Parameters:

  • anAnsiString: a string