/** * 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); }
/** * @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); }