public function writeShort($n)
    {
        if ($n < 0 || $n > 65535) {
            throw new \InvalidArgumentException('Octet out of range 0..65535');
        }

        $this->flushBits();
        $this->out .= pack('n', $n);
        return $this;
    }