Sign in Join
FPDoc Onlineexperiment

TCustomMemoryStream.SaveToStream procedure

Member of TCustomMemoryStreampublicIn unit Classes

Writes the contents of the memory stream to another stream.

Declaration

pascal
procedure 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.

This method will work much faster than the use of the 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.