/** * {@inheritdoc} */ public function serial(MemStream $s) { // string with <uint32> length counter $s->serial_string($this->name); if ($s->isReading()) { // read all remaining bytes from buffer $length = $s->getSize() - $s->getPos(); } else { $length = strlen($this->payload); } $s->serial_buffer($this->payload, $length); }