seek() public method

Seek to a position in the stream
public seek ( integer $offset, integer $whence = SEEK_SET )
$offset integer
$whence integer
Beispiel #1
0
 /**
  * Encode a stream of bytes.
  *
  * @param \Protobuf\Stream $stream
  * @param \Protobuf\Stream $value
  */
 public function writeByteStream(Stream $stream, Stream $value)
 {
     $length = $value->getSize();
     $value->seek(0);
     $this->writeVarint($stream, $length);
     $stream->writeStream($value, $length);
 }
Beispiel #2
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Unable to seek stream position to -1
  */
 public function testSeekException()
 {
     $handle = fopen('php://temp', 'w+');
     $stream = new Stream($handle);
     $stream->seek(-1);
 }