/**
  * {@inheritdoc}
  */
 public function read(StreamInterface $stream, DataSet $result)
 {
     $data = $stream->read(2);
     if (strlen($data) < 2) {
         $data = str_pad($data, 2, "", STR_PAD_LEFT);
     }
     $unpacked = unpack('S', $data);
     $this->validate($unpacked[1]);
     $result->setValue($this->getName(), $unpacked[1]);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function read(StreamInterface $stream, DataSet $result)
 {
     $vec = array();
     for ($i = 0; $i < 3; $i++) {
         $data = $stream->read(4);
         if (strlen($data) < 2) {
             $data = str_pad($data, 2, "", STR_PAD_LEFT);
         }
         $unpacked = unpack('f', $data);
         $this->validate($unpacked[1]);
         $vec[$i] = $unpacked[1];
     }
     $result->setValue($this->name, $vec);
 }
Beispiel #3
0
 /**
  * Skip ahead $this->size bytes in the stream.
  * Do not mutate the result DataSet at all.
  *
  * {@inheritdoc}
  */
 public function read(StreamInterface $stream, DataSet $result)
 {
     $stream->read($this->size->get($result));
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function read(StreamInterface $stream, DataSet $result)
 {
     $bytes = $stream->read($this->size->get($result));
     $this->validate(strval($bytes));
     $result->setValue($this->getName(), strval($bytes));
 }