Sign in Join
FPDoc Onlineexperiment

Tdecompressionstream.Seek function

Member of TdecompressionstreampublicIn unit ZStream

Move stream position to a certain location in the stream.

Declaration

pascal
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64
 ; override

Arguments

Offset

Offset to apply to the position in the stream.

Origin

Origin from where Offset should be counted.

Function result

New position in the stream.

Description

Seek overrides the standard Seek implementation. There are a few differences between the implementation of Seek in Free Pascal compared to Delphi:

  • In Free Pascal, you can perform any seek. In case of a forward seek, the Free Pascal implementation will read some bytes until the desired position is reached, in case of a backward seek it will seek the source stream backwards to the position it had at the creation time of the TDecompressionStream and then again read some bytes until the desired position has been reached.
  • In Free Pascal, a seek with soFromBeginning will reset the source stream to the position it had when the TDecompressionStream was created. In Delphi, the source stream is reset to position 0. This means that at creation time the source stream must always be at the start of the zstream, you cannot use TDecompressionStream.Seek to reset the source stream to the begin of the file.

Errors

An EDecompressionError exception is raised if the stream does not allow the requested seek operation.

See also

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