private function writeHeader()

in src/Apache/Ignite/Data/BinaryObject.php [364:393]


    private function writeHeader(): void
    {
        $this->buffer->setPosition($this->startPos);
        // type code
        $this->buffer->writeByte(ObjectType::COMPLEX_OBJECT);
        // version
        $this->buffer->writeByte(BinaryObject::VERSION);
        // flags
        $flags = BinaryObject::FLAG_USER_TYPE;
        if ($this->hasSchema) {
            $flags = $flags | BinaryObject::FLAG_COMPACT_FOOTER | BinaryObject::FLAG_HAS_SCHEMA;
        }
        if ($this->offsetType === ObjectType::BYTE) {
            $flags = $flags | BinaryObject::FLAG_OFFSET_ONE_BYTE;
        } elseif ($this->offsetType === ObjectType::SHORT) {
            $flags = $flags | BinaryObject::FLAG_OFFSET_TWO_BYTES;
        }
        $this->buffer->writeShort($flags);
        // type id
        $this->buffer->writeInteger($this->typeBuilder->getTypeId());
        // hash code
        $this->buffer->writeInteger(BinaryUtils::contentHashCode(
            $this->buffer, $this->startPos + BinaryObject::HEADER_LENGTH, $this->schemaOffset - 1));
        // length
        $this->buffer->writeInteger($this->length);
        // schema id
        $this->buffer->writeInteger($this->hasSchema ? $this->typeBuilder->getSchemaId() : 0);
        // schema offset
        $this->buffer->writeInteger($this->schemaOffset);
    }