API16:JStreamString/stream seek
From Joomla! Documentation
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;
}
Examples
Code Examples