Sets the file's current position.

        :param offset: the offset to set
        :type offset: :class:`numbers.Integral`
        :param whence: see the docs of :meth:`file.seek()`.
                       default is :const:`os.SEEK_SET`
187541
def seek(self, offset, whence=os.SEEK_SET):
        
        self.wrapped.seek(offset, whence)
46682
function _stream_seek($offset, $whence)
    {
        switch ($whence) {
            case SEEK_SET:
                if ($offset >= $this->size || $offset < 0) {
                    return false;
                }
                break;
            case SEEK_CUR:
                $offset+= $this->pos;
                break;
            case SEEK_END:
                $offset+= $this->size;
        }

        $this->pos = $offset;
        $this->eof = false;
        return true;
    }
915097
public function stream_seek($offset, $whence = SEEK_SET)
    {
        assert(null !== $this->handle);

        return 0 === fseek($this->handle, $offset, $whence);
    }
804459
public function stream_seek($offset, $whence)
	{
		// $whence: SEEK_SET, SEEK_CUR, SEEK_END
		if ($offset > $this->len)
		{
			// We can't seek beyond our len.
			return false;
		}

		switch ($whence)
		{
			case SEEK_SET:
				$this->pos = $offset;
				break;

			case SEEK_CUR:
				if (($this->pos + $offset) < $this->len)
				{
					$this->pos += $offset;
				}
				else
				{
					return false;
				}
				break;

			case SEEK_END:
				$this->pos = $this->len - $offset;
				break;
		}

		return true;
	}
92685
public function seek($handle, int $offset, int $whence = SEEK_SET) : int
    {
        $position = fseek($handle, $offset, $whence);

        if (-1 === $position) {
            throw new FileException('Cannot move pointer to desired position.');
        }

        return $position;
    }
1262639
public function stream_seek($offset, $whence = SEEK_SET)
    {
        switch ($whence) {
            case SEEK_SET:
                $this->currentlyOpenedFile->position($offset);
                break;
            case SEEK_CUR:
                $this->currentlyOpenedFile->offsetPosition($offset);
                break;
            case SEEK_END:
                $this->currentlyOpenedFile->seekToEnd();
                $this->currentlyOpenedFile->offsetPosition($offset);
        }

        return true;
    }
618031
protected int seek(long offset)
	{
		int rc;
		try
		{
			file.seek(offset);
			rc = DDC_SUCCESS;
		}
		catch (IOException ioe)
		{
			rc = DDC_FILE_ERROR;
		}
		return rc;
	}
508045
public function seek(int $offset, int $whence = \SEEK_SET): int
    {
        if (-1 === fseek($this->handle, $offset, $whence)) {
            $message = 'Could not move file pointer.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        $position = ftell($this->handle);

        if (false === $position) {
            $message = 'Could not get the file pointer position.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return $position;
    }
1233750
def _next_offset(self):
    """"""
    if self._filestream:
      offset = self._filestream.tell()
      if offset:
        offset -= 1
    else:
      offset = self._initial_offset

    return offset
225950
def align_after(self, offset):
        
        f = self.reader
        if offset <= 0:  # FIXME what is a negative offset??
            f.seek(0)
            self._block_count = 0
            self._read_header()  # FIXME we can't extimate how big it is...
            return
        sm = self.sync_marker
        sml = len(sm)
        pos = offset
        while pos < self.file_length - sml:
            f.seek(pos)
            data = f.read(self.FORWARD_WINDOW_SIZE)
            sync_offset = data.find(sm)
            if sync_offset > -1:
                f.seek(pos + sync_offset)
                self._block_count = 0
                return
            pos += len(data)
548697
def seek(self, offset):
        
        if self._shifts:
            if 0 <= offset < len(self._shifts):
                current_pos = self._file.tell()
                new_pos = self._shifts[offset]
                if current_pos != new_pos:
                    if current_pos == self._shifts[-1]:  # reached the end of the file
                        self._data = self.__reader()
                        self.__file = iter(self._file.readline, '')
                        self._file.seek(0)
                        next(self._data)
                        if offset:  # move not to the beginning of the file
                            self._file.seek(new_pos)
                    else:
                        if not self.__already_seeked:
                            if self._shifts[0] < current_pos:  # in the middle of the file
                                self._data.send(True)
                            self.__already_seeked = True
                        self._file.seek(new_pos)
            else:
                raise IndexError('invalid offset')
        else:
            raise self._implement_error
280128
def offset(self, offset):
        
        if self._offset != offset:
            self.dirty = True
            self._offset = offset
        return self
1129796
def seek(self, offset, whence=START):
        """"""
        logger.debug('seeking to offset: %r whence: %r', offset, whence)
        if whence not in WHENCE_CHOICES:
            raise ValueError('invalid whence, expected one of %r' % WHENCE_CHOICES)

        if whence == START:
            new_position = offset
        elif whence == CURRENT:
            new_position = self._current_pos + offset
        else:
            new_position = self._content_length + offset
        new_position = clamp(new_position, 0, self._content_length)
        self._current_pos = new_position
        self._raw_reader.seek(new_position)
        logger.debug('new_position: %r', self._current_pos)

        self._buffer.empty()
        self._eof = self._current_pos == self._content_length
        return self._current_pos
68628
private void setCurrentPosition(long pos) {
        if (pos == Long.MAX_VALUE) {
            pos = file.length();
        }
        if (!useLoadBuf) {
            in.position((int) pos);
            return;
        }
        try {
            if (pos >= (channel.position() - in.limit()) && pos < channel.position()) {
                in.position((int) (pos - (channel.position() - in.limit())));
            } else {
                channel.position(pos);
                fillBuffer(bufferSize, true);
            }
        } catch (Exception e) {
            log.error("Error setCurrentPosition", e);
        }

    }
52432
def setrange(self, key, offset, value):
        
        if not isinstance(offset, int):
            raise TypeError("offset argument must be int")
        if offset < 0:
            raise ValueError("offset must be greater equal 0")
        return self.execute(b'SETRANGE', key, offset, value)
1345025
def set_offset( self, offset ):
        """"""
        assert offset in range( len( self.buffer ) )
        self.pos = offset
        self._fill_buffer()
659172
def seek(self, offset, whence=0):
        '''
        
        '''
        if whence == 0:
            self._pos = self._start_pos + offset
        elif whence == 1:
            self._pos += offset
        else:
            self._pos = (self._end_pos - 1) + offset