read() публичный Метод

Read data from the stream
public read ( integer $length ) : string
$length integer
Результат string
Пример #1
0
 public function testChecksEof()
 {
     $handle = fopen('php://temp', 'w+');
     $stream = new Stream($handle);
     fwrite($handle, 'data');
     $this->assertFalse($stream->eof());
     $stream->read(4);
     $this->assertTrue($stream->eof());
 }
Пример #2
0
 /**
  * Decode a 64bit double.
  *
  * @param \Protobuf\Stream $stream
  *
  * @return float
  */
 public function readDouble(Stream $stream)
 {
     $bytes = $stream->read(8);
     if ($this->isBigEndian) {
         $bytes = strrev($bytes);
     }
     list(, $result) = unpack('d', $bytes);
     return $result;
 }