API15

JBuffer/stream seek

From Joomla! Documentation

< API15:JBuffer

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

<! removed transcluded page call, red link never existed >

Syntax[edit]

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

Defined in[edit]

libraries/joomla/utilities/buffer.php

Importing[edit]

jimport( 'joomla.utilities.buffer' );

Source Body[edit]

function stream_seek($offset, $whence)
{
        switch ($whence)
        {
                case SEEK_SET :
                        if ($offset < strlen($this->_buffers[$this->name]) && $offset >= 0) {
                                $this->position = $offset;
                                return true;
                        } else {
                                return false;
                        }
                        break;

                case SEEK_CUR :
                        if ($offset >= 0) {
                                $this->position += $offset;
                                return true;
                        } else {
                                return false;
                        }
                        break;

                case SEEK_END :
                        if (strlen($this->_buffers[$this->name]) + $offset >= 0) {
                                $this->position = strlen($this->_buffers[$this->name]) + $offset;
                                return true;
                        } else {
                                return false;
                        }
                        break;

                default :
                        return false;
        }
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]