Skip to content

TStringStream.Create

Creates a new stringstream and sets its initial content.

Declaration

Source position: classesh.inc line 1251

public 
  constructor Create(const ABytes: TBytes);  Override;  Overload;
  constructor Create(const AString: string);  Overload;
  constructor Create(const AString: string; AEncoding: TEncoding; 
                    AOwnsEncoding: Boolean);  Overload;
  constructor Create(const AString: string; ACodePage: Integer);  Overload;
  constructor Create(const AString: UnicodeString);  Overload;
  constructor Create(const AString: UnicodeString; AEncoding: TEncoding; 
                    AOwnsEncoding: Boolean);  Overload;
  constructor Create(const AString: UnicodeString; ACodePage: Integer)
                    ;  Overload;

Description

Create creates a new TStringStream instance and sets its initial content to Astring. The position is still 0 but the size of the stream will equal the length of the string.

The Encoding argument specifies the codepage with which the bytes in the string will be interpreted. If it is not specified (or Nil) the system default encoding will be used. The correct encoding can be detected from the string by using the TStringStream.CreateRaw constructor.

See also

Name Description
TStringStream.CreateRaw Create stringstream using codepage of string
TStringStream.DataString Contains the contents of the stream in string form
TStringStream.Encoding Encoding of the string with the data
TStringStream.UnicodeDataString Datastring as unicode string