public function seek($offset, $whence = SEEK_SET)
{
if (!$this->resource) {
throw new RuntimeException('No resource available; cannot seek position');
}
if (!$this->isSeekable()) {
throw new RuntimeException('Stream is not seekable');
}
$result = fseek($this->resource, $offset, $whence);
if (0 !== $result) {
throw new RuntimeException('Error seeking within stream');
}
return true;
}