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

Write data to the stream
public write ( string $bytes, integer $length ) : integer
$bytes string
$length integer
Результат integer
Пример #1
0
 /**
  * Store a single byte.
  *
  * @param \Protobuf\Stream $stream
  * @param integer          $value
  */
 public function writeByte(Stream $stream, $value)
 {
     $stream->write(chr($value), 1);
 }
Пример #2
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Failed to write 2 bytes
  */
 public function testWriteException()
 {
     $handle = fopen('php://temp', 'w+');
     $stream = new Stream($handle);
     $stream->write('', 2);
 }