Unit 'Classes' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

TCustomMemoryStream.SaveToStream

Writes the contents of the memory stream to another stream.

Declaration

Source position: classesh.inc line 1503

public procedure TCustomMemoryStream.SaveToStream(

  Stream: TStream

);

Description

SaveToStream writes the contents of the memory stream to Stream. The content of Stream is not cleared first. The current position of the memory stream is not changed by this action.

Remark:

This method will work much faster than the use of the TStream.CopyFrom method:

Seek(0,soFromBeginning);
  Stream.CopyFrom(Self,Size);

because the CopyFrom method copies the contents in blocks, while SaveToStream writes the contents of the memory as one big block.

Errors

If an error occurs when writing to Stream an EStreamError exception will be raised.

See also

TCustomMemoryStream.SaveToFile

  

Writes the contents of the stream to a file.

TStream.CopyFrom

  

Copy data from one stream to another.


Documentation generated on: Nov 23 2024