StringStream#

Qualified name: delphivcl.StringStream

class StringStream#

Bases: BytesStream

TStringStream provides file-like access to information stored as a long string. Use TStringStream to store data as a long string enhanced with I/O capabilities. TStringStream is useful as an intermediary object that can hold text as well as read it from or write it to another storage medium. TStringStream provides a mechanism for manipulating text that is obtained from a less accessible medium.

Methods

Create

Creates an instance of TStringStream.

Destroy

Destroys an instance of TMemoryStream.

Free

Frees the Wrapped Delphi Object

InheritsFrom

Returns True if Delphi Object is or inherits from ClassName

ReadBytes

Read content as bytes.

ReadFloat

Read content as float.

ReadInt

Read content as integer.

ReadString

Returns a string that consists of up to Count bytes from the current position in the string stream, and advances the current position of the stream by the number of bytes read.

SetProps

Sets several properties in one call

ToList

If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python list object.

ToTuple

If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python tuple object.

WriteBytes

Write content as bytes.

WriteFloat

Write content as float.

WriteInt

Write content as integer.

WriteString

Concatenates a specified string to the current position in the string stream, and updates the current position accordingly.

Attributes

Bytes

Specifies the stored data.

ClassName

Returns the TObject.ClassName

DataString

Provides direct access to the string that stores the text represented by the TStringStream object.

Encoding

Represents the encoding used internally by the TStringStream instance to store the data.

Memory

Provides direct access to the memory pool allocated for the memory stream.

Position

Indicates the current offset into the stream for reading and writing.

Size

Indicates the size in bytes of the stream.

ClassName#

Returns the TObject.ClassName

Create()#

Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter. Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter. Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter. Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter. Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter. Creates an instance of TStringStream. Call Create to instantiate a TStringStream object. Create initializes the DataString property to the AString parameter.

DataString#

Provides direct access to the string that stores the text represented by the TStringStream object. Use DataString to get access to the text of the stream. The text represents the information that is being transferred by means of the string stream. Size is the number of bytes in the string, and Position is the current position within DataString.

Note: DataString is a read-only property. DataString can be used to change the contents of the string, but applications can’t change the DataString itself.

Destroy()#

Destroys an instance of TMemoryStream. System.Classes.TStringStream.Destroy inherits from System.Classes.TMemoryStream.Destroy. All content below this line refers to System.Classes.TMemoryStream.Destroy. Destroys an instance of TMemoryStream. Do not call Destroy directly in an application. Instead, call Free. Free verifies that the TMemoryStream reference is not nil, and only then calls Destroy. Destroy a TMemoryStream object when it is no longer needed to store or write data. Destroy calls Clear to free the memory buffer before calling the inherited destructor.

Encoding#

Represents the encoding used internally by the TStringStream instance to store the data. Encoding represents the encoding that is used to get the corresponding array of bytes from a given string, or to obtain the corresponding string from the contained array of bytes. (A string stream contains an array of bytes.) The encoding of a stream string is set in the constructor (you can specify what encoding to use).

Free()#

Frees the Wrapped Delphi Object

InheritsFrom(ClassName)#

Returns True if Delphi Object is or inherits from ClassName

ReadBytes()#

Read content as bytes.

ReadFloat()#

Read content as float.

ReadInt()#

Read content as integer.

ReadString(Count: Integer) string#

Returns a string that consists of up to Count bytes from the current position in the string stream, and advances the current position of the stream by the number of bytes read. Use Read to read the contents of the string stream into a string, starting at the current position. If Count extends beyond the end of the DataString, the returned string will only contain the characters up to the end of DataString, and the current position is advanced accordingly.

Note: ReadString does the same thing as Read, except that it returns a string rather than filling a buffer.

SetProps(prop1=val1, prop2=val2...)#

Sets several properties in one call

ToList()#

If the object is a container (TStrings, TComponent…), it returns the content of the sequence as a Python list object.

ToTuple()#

If the object is a container (TStrings, TComponent…), it returns the content of the sequence as a Python tuple object.

WriteBytes()#

Write content as bytes.

WriteFloat()#

Write content as float.

WriteInt()#

Write content as integer.

WriteString(AString: string)#

Concatenates a specified string to the current position in the string stream, and updates the current position accordingly. Use WriteString to replace the end of the string from the current position on with the string specified by the AString parameter. WriteString changes the Size property to reflect the new length of the DataString.