[Overview][Types][Classes][Index] | Reference for unit 'zstream' (#fcl)

# Tdecompressionstream.seek

Move stream position to a certain location in the stream.

## Declaration

Source position: zstream.pp line 78

`public function Tdecompressionstream.seek(`
`offset: LongInt;`
`origin: Word`
`):LongInt; 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

Read |  | Read data from the compressed stream

The latest version of this document can be found at lazarus-ccr.sourceforge.net.