Class TStreamHelper

Unit

Declaration

type TStreamHelper = class helper(TObject) for TStream

Description

TStream helper class for string manipulation in streams

Hierarchy

Overview

Methods

Public function GetString: String;
Public procedure SetString(const AString: String);

Description

Methods

Public function GetString: String;

Reads a string from the stream, which was previously written with SetString.

Example:

var
  MyStream: TMemoryStream;
  S: String;
begin
  MyStream := TMemoryStream.Create;
  try
    MyStream.SetString('Hello, World!');
    MyStream.Position := 0;
    S := MyStream.GetString;
    Writeln('Read string: ', S);
  finally
    MyStream.Free;
  end;
end;

Returns

The string read from the stream.

Public procedure SetString(const AString: String);

Writes a string to the stream, preceded by its length.

Example:

var
  MyStream: TMemoryStream;
begin
  MyStream := TMemoryStream.Create;
  try
    MyStream.SetString('Hello, World!');
  finally
    MyStream.Free;
  end;
end;

Parameters
S
The string to write to the stream.

Generated by PasDoc 0.16.0-snapshot.