Actions

API16

JStreamString/stream seek

From Joomla! Documentation

< API16:JStreamString
Revision as of 17:48, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[Edit Descripton]

Description:JStreamString/stream seek

Contents

Syntax

stream_seek($offset, $whence)
Parameter Name Default Value Description
$offset
$whence

Defined in

libraries/joomla/filesystem/streams/string.php

Importing

jimport( 'joomla.filesystem.streams.string' );

Source Body

function stream_seek($offset, $whence) {
        //$whence: SEEK_SET, SEEK_CUR, SEEK_END
        if($offset > $this->_len) {
                return false; // we can't seek beyond our len
        }
        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;
}

[Edit See Also] SeeAlso:JStreamString/stream seek

Examples

<CodeExamplesForm />