TECLMemoryStream.Seek
TECLMemoryStream
Moves the current position of the stream by Offset bytes, relative to the origin specified by Origin.
function Seek(Offset: Longint; Origin: Word): Longint; override;
Description
Use Seek to move the current position within the memory stream by the indicated offset. Seek allows an application to read from or write to a particular location within the data associated with the memory stream.
If Offset is a negative number, the seek is backward from the specified origin. The following table shows the different values of Origin and their meanings for seeking.
Value |
Meaning |
soFromBeginning |
Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. |
soFromCurrent |
Offset is from the current position in the resource. Seek moves to Position + Offset. |
soFromEnd |
Offset is from the end of the resource. Offset must be <= 0 to indicate a number of bytes before the end of the file. |
Seek returns the new value of the Position property, the new current position in the resource.
Note:
Seek does no error checking on the value provided for Offset. Do not call seek with an offset that would move the current position less than 0 (before the start of memory data) or greater than Size (beyond the end of the memory buffer).
|