function read($length)
    {
        $l = $this->pos+$length < strlen($this->data) ? $length : strlen($this->data)-$this->pos;
        $result = substr($this->data,$this->pos,$l);
        $this->pos+=$l;
        return $result;
    }